Create a Coffee Ordering App in Python

☕ Create a Coffee Ordering App in Python



In this simple Python mini project, we’ll build a Coffee Ordering App that lets users order multiple coffee items, view their cart, and checkout — all from the console. It<’s a perfect exercise for Python beginners who want to practice loops, functions, and dictionaries.

Difficulty: Easy
Time Required: 2 minutes
Language: Python 3

📑 Table of Contents

✨ Features of the Coffee App

  • Displays a coffee menu with prices
  • Allows multiple orders
  • Adds items to a cart
  • Views total order summary
  • Performs checkout with a thank-you message

💻 Full Source Code (Copy & Paste)

print("☕ Welcome to Python Coffee Shop ☕")

menu = {
    "Espresso": 50,
    "Latte": 70,
    "Cappuccino": 80,
    "Mocha": 90,
    "Black Coffee": 40
}

cart = {}

def show_menu():
    print("\nMenu:")
    for item, price in menu.items():
        print(f"  {item}: ₹{price}")

def add_to_cart():
    show_menu()
    choice = input("\nEnter coffee name: ").title()
    if choice in menu:
        qty = int(input("Enter quantity: "))
        cart[choice] = cart.get(choice, 0) + qty
        print(f"✅ {qty} {choice}(s) added to cart.")
    else:
        print("❌ Sorry, that’s not on the menu.")

def view_cart():
    if not cart:
        print("\n🛒 Cart is empty.")
    else:
        print("\n🛒 Your Cart:")
        total = 0
        for item, qty in cart.items():
            price = menu[item] * qty
            total += price
            print(f"  {item} x {qty} = ₹{price}")
        print(f"Total Amount: ₹{total}")

def checkout():
    if not cart:
        print("\n🛒 Cart is empty. Add something first!")
        return
    view_cart()
    print("\n💳 Checking out...")
    print("Thank you for ordering from Python Coffee Shop! ☕❤️")

while True:
    print("\n1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit")
    choice = input("Select an option: ")
    if choice == '1':
        add_to_cart()
    elif choice == '2':
        view_cart()
    elif choice == '3':
        checkout()
        break
    elif choice == '4':
        print("👋 See you soon at Python Coffee Shop!")
        break
    else:
        print("❌ Invalid option, try again.")

⚙️ How It Works

  1. Menu: The app displays available coffee types and their prices.
  2. Add Order: The user chooses a coffee and quantity, which is stored in a dictionary called cart.
  3. View Cart: Shows all added items and the total cost.
  4. Checkout: Prints a thank-you message and exits the app.

🖥️ Sample Output

☕ Welcome to Python Coffee Shop ☕

Menu:
  Espresso: ₹50
  Latte: ₹70
  Cappuccino: ₹80
  Mocha: ₹90
  Black Coffee: ₹40

1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit
Select an option: 1
Enter coffee name: Latte
Enter quantity: 2
✅ 2 Latte(s) added to cart.

🛒 Your Cart:
  Latte x 2 = ₹140
Total Amount: ₹140
💳 Checking out...
Thank you for ordering from Python Coffee Shop! ☕❤️

❓ Frequently Asked Questions

1. Can I add more coffee types?

Yes! Just edit the menu dictionary and add new items like "Cold Coffee": 60.

2. How do I run this code?

Save it as coffee.py and run it using the command python coffee.py in your terminal.

3. Can I convert this into a GUI app?

Yes, you can use Python’s Tkinter module to create a graphical coffee ordering interface.

4. Is this suitable for beginners?

Absolutely! It’s a simple exercise to learn functions, loops, and dictionaries in Python.


Author: Amal | Website: DomeBytes.com

📽️ Watch the full video tutorial here: WATCH NOW

Previous Post Next Post

Total Pageviews

Search here..