program5_1.py Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends. Sample Output How many different items are being purchased? 2 Enter description of item 1 dinner Enter price of item 1 2.97 Enter the quantity for item 1 2 Item: dinner, subtotal: $5.94 Enter description of item 2 milk Enter price of item 2 3.29 Enter the quantity for item 2 3 Item: milk, subtotal: $9.87 Your total is $15.81
program5_1.py
Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends.
both program5_1.py and subtotal.py should be in same directory. You can name the directory whatever you want. But make sure you don't change the name "subtotal.py". If you change it, then also modify the import statement in the first line of program5_1.py
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images