CJCoding With Joseph
15free / daySign inCreate account

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.

Hints4 available
Topics:
Classes
📥 Auto-Input:
50\n30\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.