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.
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