livepython.net

69. Python Program to Make a Simple ATM

HardNested if

Overview

Put the whole chapter together: input, an elif chain in the right order, and a calculation in the else.

Problem Statement

An ATM has a balance of 5000. Read the amount to withdraw (a whole number) and print: Invalid amount if it is 0 or less; Enter a multiple of 100 if it is not a multiple of 100; Insufficient balance if it is more than 5000. Otherwise print two lines, like this for 1200:

Please take 1200
Balance left: 3800

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One value per line, in this order. Example:

1200

Output

The output for that example:

Please take 1200
Balance left: 3800

The tests try 5 different inputs.

Learn this firstChapter 8 · Nested if and Common if Mistakes in Python
solution.py
# write your code here

EXPECTED OUTPUT

1Please take 1200
2Balance left: 3800

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.