Python Functions
💡
Exercise 33

Drive-Thru 20 XP Medium

Ctrl+Enter Run Ctrl+S Save

Let's build a drive-thru ordering system using everything we've learned about functions!

Dictionaries are another useful data structure. They store key-value pairs:

menu = { 'burger': 5.99, 'fries': 2.99, 'drink': 1.99 }

Access values with square brackets:

print(menu['burger']) # 5.99
📋 Instructions
Create a drive-thru program: 1. Define a `menu` dictionary with at least 5 items and prices 2. Create a function `order(items)` that takes a list of item names 3. The function should print each item with its price 4. Print the total at the end Example: ``` --- Your Order --- Burger: $5.99 Fries: $2.99 ----------------- Total: $8.98 ```
Loop through the items list, look up each in menu dict, keep a running total. You've got this — take it step by step!
⚠️ Try solving it yourself first — you'll learn more!
menu = {
    'burger': 5.99,
    'fries': 2.99,
    'drink': 1.99
}
main.py
Hi! I'm Rex 👋
Output
Ready. Press ▶ Run or Ctrl+Enter.