Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

What is the best conclusion for Xbar Chart? UCL A X B C B A LCL

Answered: 1 week ago

Question

Question What integration level should an employer choose?

Answered: 1 week ago