141. Fix a Messy Python Program That Won't Run
MediumPEP 8
Overview
This program breaks one rule that Python enforces, and several style rules that it doesn't. Fix both kinds.
Problem Statement
The program reads how many items you buy (each costs 120), prints whether delivery is free (total above 300) or costs 40, and then prints the total. For example, for 3:
Free delivery
Total: 360
It doesn't run yet. Fix it, then tidy it:
- remove the indentation that Python refuses,
- indent every block by exactly 4 spaces,
- put one space on each side of
=,*and>, and one space after every comma.
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
The tests check only the output, so they can't see your spacing: check the last two rules yourself before you submit.
Input
One value per line, in this order. Example:
3
Output
The output for that example:
Free delivery
Total: 360
The tests try 4 different inputs.