Untitled

 avatar
unknown
plain_text
a year ago
3.6 kB
5
Indexable
# Quiz game with an extended shop feature
score = 0
money = 0
points_to_dollars = 2
style_choices = ["Red", "Blue", "Green", "Yellow", "Purple"]
goods_choices = ["Melons", "Strawberries", "Yogurt", "Chocolate", "Coconut"]
upgrade_choices = [
    {"name": "Juice Mixer", "cost": 20, "customer_cost_multiplier": 1.5, "recipes": ["Mixed Juice", "Fruit Smoothie"]},
    {"name": "Blender", "cost": 40, "customer_cost_multiplier": 2, "recipes": ["Fruit Shake", "Super Smoothie"]}
]

# Function to display the shop
def display_shop():
    print("\nWelcome to the Shop!")
    print("1. Style")
    print("2. Goods")
    print("3. Upgrade")
    print("4. Exit the shop")

# Function to display style choices
def display_style_shop():
    print("\nStyle Choices (Choose one for free):")
    for i, color in enumerate(style_choices, 1):
        print(f"{i}. {color}")

# Function to display goods choices
def display_goods_shop():
    print("\nGoods Choices (Each costs $20, and customers pay $30):")
    for i, item in enumerate(goods_choices, 1):
        print(f"{i}. {item}")

# Function to display upgrade choices
def display_upgrade_shop():
    print("\nUpgrade Choices (Each upgrade costs $20 more, and customer costs are doubled):")
    for i, upgrade in enumerate(upgrade_choices, 1):
        print(f"{i}. {upgrade['name']}")

# Question 1
print("Question 1: What is the capital of France?")
answer1 = input("Your answer: ")
if answer1.lower() == "paris":
    print("Correct! You earned a point.")
    score += 1
else:
    print("Oops, that's not correct.")

# ... (Add more questions here)

# Display the current score and money
print("\nYour current score is:", score)
print("You have $", money)

# Shop feature
while True:
    display_shop()
    choice = input("Enter the number of the shop category you want to visit (1/2/3/4): ")
    
    if choice == "1":  # Style
        display_style_shop()
        style_choice = input("Choose a style (1-5): ")
        if style_choice.isdigit() and 1 <= int(style_choice) <= 5:
            chosen_style = style_choices[int(style_choice) - 1]
            print(f"You've chosen the {chosen_style} style.")
        else:
            print("Invalid choice. Please select a valid style.")
    
    elif choice == "2":  # Goods
        display_goods_shop()
        goods_choice = input("Choose a goods item (1-5): ")
        if goods_choice.isdigit() and 1 <= int(goods_choice) <= 5:
            chosen_goods = goods_choices[int(goods_choice) - 1]
            money -= 20
            print(f"You're now selling {chosen_goods}. Customers will pay $30 for it.")
        else:
            print("Invalid choice. Please select a valid goods item.")
    
    elif choice == "3":  # Upgrade
        display_upgrade_shop()
        upgrade_choice = input("Choose an upgrade (1-2): ")
        if upgrade_choice.isdigit() and 1 <= int(upgrade_choice) <= 2:
            chosen_upgrade = upgrade_choices[int(upgrade_choice) - 1]
            money += 20  # Each upgrade costs $20 more
            customer_cost_multiplier = chosen_upgrade["customer_cost_multiplier"]
            print(f"You've upgraded to a {chosen_upgrade['name']}. Customers now pay ${30 * customer_cost_multiplier}.")
            # You can add new recipes and effects based on the upgrade here.
        else:
            print("Invalid choice. Please select a valid upgrade.")
    
    elif choice == "4":
        print("Exiting the shop.")
        break
    else:
        print("Invalid choice. Please select a valid shop category.")

# Display the final score and money
print("\nYour final score is:", score)
print("You have $", money)
Editor is loading...
Leave a Comment