Episode 20 of 29

Bar Tab Calculator

Build a practical bar tab calculator project using everything learned so far.

Let us build a Bar Tab Calculator — a practical project using all concepts learned so far!

Project Overview

Create a program that takes drink orders, calculates totals, adds tax, and splits the bill.

Key Concepts Used

  • Dictionaries (menu with prices)
  • Lists (storing orders)
  • Loops (taking multiple orders)
  • Functions (calculating totals)
  • String formatting (displaying results)
  • User input (interactive menu)

Core Logic

menu = {
    "coffee": 150,
    "tea": 80,
    "juice": 120,
    "water": 30
}

orders = []
while True:
    item = input("Order (or done): ").lower()
    if item == "done":
        break
    if item in menu:
        orders.append(item)
        print(item + " added!")
    else:
        print("Not on menu")

total = sum(menu[item] for item in orders)
print("Total:", total)