Account With A History
Account With A History
Write the whole BankAccount class from scratch. The constructor stores owner, a float balance and an empty list attribute transactions of strings. deposit(amount) adds to the balance and appends deposit <amount> to the list; withdraw(amount) prints exactly Insufficient funds and records nothing when amount is more than the balance, otherwise subtracts it and appends withdraw <amount>; history() prints <owner>: <balance> and then each recorded transaction on its own line, oldest first. Do NOT write a main block or any top-level test code; the tests construct the class. Input: two lines, a deposit amount and then a withdrawal amount, which the tests read as floats and apply in that order to an account opened with 100.0; they then call history and print how many transactions were recorded.
Expected Output:
Maya: 120.0 deposit 50.0 withdraw 30.0 2
= newline. The output ends with a newline — print one after the last line.
Your Output
Run your code to see the output here...