LearnPy Hub
← Classes & Objects problems
Medium

Bank Account

Write BankAccount with deposit and withdraw. A withdrawal larger than the balance is refused and prints Refused. Read the start balance, then n commands like d 500 or w 200, and print the final balance.

Input

Balance, n, then n commands.

Output

Messages, then the balance.

Sample 1

Input
1000
3
d 500
w 200
w 5000
Output
Refused
1300

Sample 2

Input
0
1
w 1
Output
Refused
0
solution.py
Output appears here
Bank Account · Python practice problem · LearnPy Hub