LearnPy Hub
← Exceptions problems
Medium

Custom Error With Data

Make class InsufficientFunds(Exception) that stores the balance and the amount and has the message need X more. Start with a balance; for each withdrawal either subtract it or catch the error and print its message. Finally print the balance.

Input

Balance, then withdrawals on one line.

Output

Lines.

Sample 1

Input
100
30 80 50
Output
need 10 more
20

Sample 2

Input
10
5
Output
5
solution.py
Output appears here
Custom Error With Data · Python practice problem · LearnPy Hub