Answer to Question #171653 in Python for Andu

Question #171653

Write a class named "BankAccount" with the following attributes: id, currency and balance. The class has a constructor with only two of the attributes: id and currency. The value of the currency, if omitted, has a default value "EUR0". The third attribute by default is zero. We suppose that when we activate a bank account its balance is initially empty.


1
Expert's answer
2021-03-16T01:14:51-0400
class BankAccount():
  def __init__(self, id, currency = 'EUR0'):
    self.id = id
    self.currency = currency
    self.balance = 0
a = BankAccount(123)

hope you meant that

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS