Question:
Make a class definition for a BankAccount. It should have attributes for :
– its name (a string),
– account number (a string or integer),
– and balance (a float).
It should have methods to:
– make deposits with displaying the balance,
– and make withdrawals with displaying the balance.
Hint:

Jesse Shi
Posted at 22:36h, 20 Septemberclass BankAccount:
def __init__(self, name, acct, balance):
self.name = Jesse Macree
self.acct = 70021320
self.balance =
def deposit(self,amount):
self.balance +=
print (“you have deposited $”,,”into your account”)
print(“your balance is $”,)
def withdraw(self, amount):
self.balance -=
print(“you have withdraw $”,, “from your account”)
print(“your balance is $”,)
Jesse Shi
Posted at 22:36h, 20 SeptemberI don’t get what a balance is…
Ethan Li
Posted at 22:07h, 21 Septemberclass BankAccount:
def __init__(self, name, acct, balance):
self.name = EthanLi
self.acct = 12352488
self.balance = 1000
def deposit(self,amount):
self.balance += amount
print (‘you have deposited $’,amount,’into your account’)
print(‘your balance is $’,self.balance+=amount)
def withdraw(self, amount):
self.balance -= amount
print(‘you have withdraw $’,amount, ‘from your account’)
print(‘your balance is $’,self.balance-=amount)