Skip to content

RohanSMetkar/Bank_Account_Problem_For_Withdraw_And_Deposit_in_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Object-Oriented Programming Challenge: Bank Account

This repository contains a Python solution for a classic OOP challenge. The goal was to create a functional bank account class that manages balances while preventing overdrawn transactions.

🚀 Features

  • Encapsulation: Manages account data using class attributes (owner, balance).
  • Deposit Logic: Increases the balance based on user input.
  • Secure Withdrawals: Includes a logical check to ensure withdrawals do not exceed the available balance.
  • String Representation: Uses the __str__ method for clean, readable object printing.

🛠️ How It Works

The Account class is initialized with an owner's name and an optional starting balance.

  1. Deposit: Adds funds and confirms the transaction.
  2. Withdrawal: Checks if balance >= withdrawal_amount. If true, funds are deducted; otherwise, an error message is displayed.

💻 Usage Example

# Instantiate the class
acct = Account("Rsm", 10000)

# Make a deposit
acct.deposit(500)

# Attempt a withdrawal
acct.withdrawl(2000)

# Check account status
print(acct)

About

it’s a task to build a BankAccount class. It needs an owner and a balance, plus two actions: deposit and withdraw. The main goal is to prevent the balance from ever dropping below zero

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages