Food Guessing Game
import random
foods = [
{"name": "Pizza", "description": "A baked dish made of dough, tomato sauce, and toppings such as cheese and meat."},
{"name": "Sushi", "description": "A Japanese dish consisting of small balls or rolls of vinegar-flavored cold cooked rice served with a garnish of vegetables, egg, or raw seafood."},
{"name": "Burger", "description": "A sandwich consisting of a grilled beef patty served on a bun, often with cheese, lettuce, tomato, and other toppings."},
{"name": "Taco", "description": "A traditional Mexican dish consisting of a corn or wheat tortilla filled with meat, beans, cheese, and vegetables."},
{"name": "Pad Thai", "description": "A stir-fried noodle dish commonly served as a street food and in casual restaurants in Thailand."},
{"name": "Fish and Chips", "description": "A British dish consisting of battered fish and deep-fried chips (French fries)."}
]
points = 0
for i in range(len(foods)):
food = random.choice(foods)
print("What food item is described as follows?")
print(food["description"])
guess = input("Guess the name of the food item: ")
if guess.lower() == food["name"].lower():
print("Correct! You earned 10 points.")
points += 10
else:
print("Incorrect. The correct answer is", food["name"], ". You lost 5 points.")
points -= 5
foods.remove(food)
print("Game over. Your final score is", points)
import random
foods = [ {"name": "Pizza", "description": "A baked dish made of dough, tomato sauce, and toppings such as cheese and meat."},
{"name": "Sushi", "description": "A Japanese dish consisting of small balls or rolls of vinegar-flavored cold cooked rice served with a garnish of vegetables, egg, or raw seafood."},
{"name": "Burger", "description": "A sandwich consisting of a grilled beef patty served on a bun, often with cheese, lettuce, tomato, and other toppings."},
{"name": "Taco", "description": "A traditional Mexican dish consisting of a corn or wheat tortilla filled with meat, beans, cheese, and vegetables."},
{"name": "Pad Thai", "description": "A stir-fried noodle dish commonly served as a street food and in casual restaurants in Thailand."}, {"name": "Fish and Chips", "description": "A British dish consisting of battered fish and deep-fried chips (French fries)."}]
points = 0
rounds = 5
for i in range(rounds):
# Select two random foods from the list
food1, food2 = random.sample(foods, 2)
print("Which of the following foods is described as follows?")
print("1. " + food1["description"])
print("2. " + food2["description"])
guess = int(input("Enter 1 or 2 to guess: "))
if guess == 1 and food1["name"].lower() == input("Guess the name of the first food item: ").lower():
print("Correct! You earned 10 points.")
points += 10
elif guess == 2 and food2["name"].lower() == input("Guess the name of the second food item: ").lower():
print("Correct! You earned 10 points.")
points += 10
else:
print("Incorrect. The correct answer is", food1["name"] + " or " + food2["name"], ". You lost 5 points.")
points -= 5
print("Game over. Your final score is", points)
import random
foods = [
{"name": "Pizza", "description": "A baked dish made of dough, tomato sauce, and toppings such as cheese and meat."},
{"name": "Sushi", "description": "A Japanese dish consisting of small balls or rolls of vinegar-flavored cold cooked rice served with a garnish of vegetables, egg, or raw seafood."},
{"name": "Burger", "description": "A sandwich consisting of a grilled beef patty served on a bun, often with cheese, lettuce, tomato, and other toppings."},
{"name": "Taco", "description": "A traditional Mexican dish consisting of a corn or wheat tortilla filled with meat, beans, cheese, and vegetables."},
{"name": "Pad Thai", "description": "A stir-fried noodle dish commonly served as a street food and in casual restaurants in Thailand."},
{"name": "Fish and Chips", "description": "A British dish consisting of battered fish and deep-fried chips (French fries)."}
]
# Select two random foods from the list
food1, food2 = random.sample(foods, 2)
print("Which of the following foods is described as follows?")
print("1. " + food1["description"])
print("2. " + food2["description"])
guess = int(input("Enter 1 or 2 to guess: "))
if guess == 1 and food1["name"].lower() == input("Guess the name of the first food item: ").lower():
print("Correct! You guessed the food item correctly.")
elif guess == 2 and food2["name"].lower() == input("Guess the name of the second food item: ").lower():
print("Correct! You guessed the food item correctly.")
else:
print("Incorrect. The correct answer for Question 1 is", food1["name"] + " and the answer for the Question 2 is" + food2["name"])
print("Thanks For Playing the Game.")
import random
foods = [
{"name": "Pizza", "description": "A baked dish made of dough, tomato sauce, and toppings such as cheese and meat."},
{"name": "Sushi", "description": "A Japanese dish consisting of small balls or rolls of vinegar-flavored cold cooked rice served with a garnish of vegetables, egg, or raw seafood."},
{"name": "Burger", "description": "A sandwich consisting of a grilled beef patty served on a bun, often with cheese, lettuce, tomato, and other toppings."},
{"name": "Taco", "description": "A traditional Mexican dish consisting of a corn or wheat tortilla filled with meat, beans, cheese, and vegetables."},
{"name": "Pad Thai", "description": "A stir-fried noodle dish commonly served as a street food and in casual restaurants in Thailand."},
{"name": "Fish and Chips", "description": "A British dish consisting of battered fish and deep-fried chips (French fries)."}
]
# Select two random foods from the list
food1, food2 = random.sample(foods, 2)
print("Which of the following foods is described as follows?")
print("1. " + food1["description"])
print("2. " + food2["description"])
guess = int(input("Enter 1 or 2 to guess: "))
if guess == 1 and food1["name"].lower() == input("Guess the name of the first food item: ").lower():
print("Correct! You guessed the food item correctly.")
elif guess == 2 and food2["name"].lower() == input("Guess the name of the second food item: ").lower():
print("Correct! You guessed the food item correctly.")
else:
print("Incorrect. The correct answer for Question 1 is", food1["name"] + " and the answer for the Question 2 is" + food2["name"])
print("Thanks For Playing the Game.")