livepython.net

68. Python Program to Divide Two Numbers Safely

EasyNested if

Overview

Check input before using it.

Problem Statement

Read two whole numbers. If the second one is 0, print Cannot divide by zero. Otherwise print the first divided by the second with two decimal places. For example, for 7 and 2:

3.50

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:

7
2

Output

The output for that example:

3.50

The tests try 3 different inputs.

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

EXPECTED OUTPUT

13.50

YOUR OUTPUT

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