LearnPy Hub
← Exceptions problems
Medium

Insufficient Funds

Write class InsufficientFunds(Exception) and a function withdraw(balance, amount) that raises it when amount > balance and otherwise returns the new balance. Read a balance and then amounts on one line; for each, print the new balance or declined: AMOUNT.

Input

A balance, then amounts.

Output

One line per amount.

Sample 1

Input
100
30 80 50
Output
70
declined: 80
20

Sample 2

Input
10
20
Output
declined: 20
solution.py
Output appears here
Insufficient Funds · Python practice problem · LearnPy Hub