TORONTO KIDS COMPUTER CLUB | Monday 20:00 Python Practice 20.09.14.
18306
post-template-default,single,single-post,postid-18306,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Monday 20:00 Python Practice 20.09.14.

16 Sep Monday 20:00 Python Practice 20.09.14.

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:

3 Comments
  • Jesse Shi
    Posted at 22:36h, 20 September Reply

    class 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 September Reply

    I don’t get what a balance is…

  • Ethan Li
    Posted at 22:07h, 21 September Reply

    class 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)

Post A Comment