Menu
CoddyTech

Recap: Rewrite a Receipt

Lesson 6 of 48 in Coddy's Python for Rust Developers course.

challenge icon

Challenge

Beginner

Read three lines: an item name, a nonnegative integer quantity, and a nonnegative integer unit price in cents. Compute quantity times unit price. If quantity is greater than 3, subtract 10 cents from the total; tests guarantee the undiscounted total is at least 10 in that case. Print the item name, then the final integer total on the next line. Print bulk on a third line only when the discount applies. The item name may contain spaces.

Print only the requested output, with a newline after each line. The supplied input lines read the test data; keep them and add your work below.

Your code goes in main.py. The locked driver.py starts your program and cannot be edited.

Try it yourself

# Starts the program in main.py. Edit main.py to solve the challenge.
from runpy import run_module

run_module("main", run_name="__main__")

All lessons in Python for Rust Developers

Practice on your own: Online Python compiler