make a text-based self ordering kiosk in python

To create a text-based self-ordering kiosk in Python, you can use the built-in input() function to prompt the user for their orders and print() function to display the menu options and order summary.

Here's an example implementation:

main.py
# List of available items and their prices
menu = {
    "Burger": 5.0,
    "Fries": 2.5,
    "Drink": 1.0
}

# Prompt user for orders
print("Welcome to the Self-Ordering Kiosk! Please choose from the menu below:")
for item, price in menu.items():
    print(f"{item}: ${price:.2f}")

orders = {}
while True:
    choice = input("Enter an item name to order or 'done' to finish: ")
    if choice == "done":
        break
    elif choice in menu:
        qty = int(input("Enter quantity: "))
        orders[choice] = orders.get(choice, 0) + qty
    else:
        print("Invalid item name. Please try again.")

# Display order summary
if orders:
    print("Here's your order summary:")
    total_cost = 0.0
    for item, qty in orders.items():
        price = menu[item]
        cost = price * qty
        print(f"{item}: {qty} x ${price:.2f} = ${cost:.2f}")
        total_cost += cost
    print(f"Total cost: ${total_cost:.2f}")
else:
    print("No orders were made.")
965 chars
36 lines

Note that this is just a basic implementation and can be extended further based on requirements (e.g. integrating with payment gateway, storing orders in a database, etc.).

gistlibby LogSnag