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.

Relax

Respuesta :

Using the knowledge in computational language in python it is possible to write a code that operates like a cashier terminal in a grocery store.

Writting the code:

def subtotal(description, price, quantity):

total = price * quantity

print("Item: " + description + ", subtotal: $" + str(round(total, 2)))

return total

import subtotal

num = int(input("How many different items are being purchased? "))

total = 0

for i in range(num):

desc = input("Enter description of item " + str(i+1) + " ")

price = float(input("Enter price of item " + str(i+1) + " "))

quant = int(input("Enter the quantity for item " + str(i+1) + " "))

total = total + subtotal.subtotal(desc, price, quant)

print("\nYour total is $" + str(round(total, 2)))

See more about python at brainly.com/question/12975450

#SPJ1

Ver imagen lhmarianateixeira