Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Bankaccount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Bank_Account:
def __init__(self, name, balance=0):
self.name = name
self.balance = balance
print(f"Hello!! Welcome {self.name}")

def deposit(self):
amount = float(input("Enter the amount to be deposited: "))
self.balance += amount
print(f"{self.name} deposited: , {amount}")


def withdraw(self):
amount = float(input("Enter the amount to be Withdrawn: "))
if self.balance>=amount:
self.balance-=amount
print(f"{self.name} withdrew: {amount} today")
else:
print(f"Insufficient balance ")

def display(self):
print(f"Your Net Available Balance=: ", self.balance)

# creating an object of class
b1 = Bank_Account("Mary", 300)

# Calling functions with that class object
b1.deposit()
b1.withdraw()
b1.display()