CJCoding With Joseph
15free / daySign inCreate account

Withdraw Or Refuse

A BankAccount stores an owner and a balance. Write the body of withdraw: when amount is more than the balance, print exactly Insufficient funds and leave the balance alone; otherwise subtract the amount from the balance. Do NOT write a main block or any top-level test code; the tests construct the class. Input: one line, the amount to withdraw, which the tests read as a float, pass to withdraw on an account opened with 100.0, and then print the balance.

Expected Output:

70.0

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Classes
📥 Auto-Input:
30\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.