🚀 Escape Room Python Hacks

  1. Simulate rolling two dice and show all possible sums of their outcomes.
# 🎲 Die faces: 1, 2, 3, 4, 5, 6
# TODO: Write code to calculate and display all possible sums
# Hint: You may need two nested loops

  1. Create a fortune teller program. The response “Try Again” should appear 40% of the time, while the other possible responses are “Yes”, “No”, and “Maybe”.
import random

# 🔮 Fortune Teller
# TODO: Generate a random number between 1 and 100

if num <= /* fill in */:
    print("Try Again")
elif num <= /* fill in */:
    print("Yes")
elif num <= /* fill in */:
    print("No")
else:
    print("Maybe")

  1. Create a program that randomly selects a meal from a menu list. For example: “Pizza”, “Burger”, “Salad”, “Pasta”, “Sushi”.
import random

# 🍔 Menu list of meals
meals = [/* add your meals here */]

# TODO: Pick one random meal from the list

  1. Practice using random.choice() and random.shuffle().
  • Use random.choice() to select one random card from a deck.

  • Use random.shuffle() to shuffle the entire deck.

import random

# 🃏 Deck of cards (simplified as numbers 1–10 for this example)
deck = [1,2,3,4,5,6,7,8,9,10]

# TODO: Use random.choice() to pick one card
# TODO: Use random.shuffle() to shuffle the deck and print it