I'd like you to make a class that represents a bank account.
Your bank account should accept an optional
balance argument (defaulting to 0), have a
balance attribute, and have
>>> a1 = BankAccount() >>> a1.balance 0 >>> a1.deposit(10) >>> a1.balance 10 >>> a2 = BankAccount(balance=20) >>> a2.withdraw(15) >>> a2.balance 5 >>> a1.transfer(a2, 3) >>> a1 BankAccount(balance=7) >>> a2 BankAccount(balance=8)
Your bank account should also have a nice string representation (as shown above).
This example might not seem realistic (it's not) but it's a classic example for good reason:
This is just a preview of the problem statement.
This exercise includes 3 bonuses, 7 hint links, and automated tests.