Question: Write a program ( q 1 . py ) that produces a grocery store checkout receipt. Because we have not learned about loops yet we

Write a program (q1.py) that produces a grocery store checkout receipt. Because we have not learned about loops yet we will limit ourselves to exactly 4 items so imagine that your software is running on a checkout counter that says 4 items only. Prompt the user for 4 items. The user will enter three things for each item separated by spaces.
Name of the item
Price per unit
Quantity
For example: input apples 1.802.5 mean item name is apples, price per unit is $1.80/lb and 2.5lb apples are purchased.
You must accept the user input and store it in a dictionary. The keys for the dictionary will be 1,2,3 and 4 and the value will be tuples. For example, the tuple for the item entered above is (apples,1.80,2.5).
Print the dictionary after all 4 items are added. You should be able to do this by passing the constructed dictionary to the print function. Then print the receipt in the format shown below. You will need format control strings for this. You need to calculate the required totals. The field sizes are 3,14,14,12, and 9.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!