mail@pastecode.io avatar
19 days ago
1.1 kB
Certainly! One fun candy-themed game you can create is a simple guessing game called "Candy Crunch." Here's a simple Python implementation:

import random

# List of candies
candies = ['chocolate', 'lollipop', 'gummy bear', 'caramel', 'toffee', 'jelly bean', 'candy cane', 'marshmallow', 'taffy', 'rock candy']

# Select a random candy
secret_candy = random.choice(candies)

print("Welcome to Candy Crunch! Guess the secret candy to win.")

# Player's initial guess
guess = input("Enter your guess: ").lower()

# Number of attempts
attempts = 1

# While loop to check the guess
while guess != secret_candy:
    print("Oops! That's not the right candy.")
    guess = input("Try again: ").lower()
    attempts += 1

# Congratulate the player on winning
print(f"Congratulations! You've guessed the secret candy '{secret_candy}' in {attempts} attempts!")

In this game, the player has to guess the name of the secret candy randomly chosen from a predefined list. The game will provide feedback on whether the guess is correct or not and keep track of the number of attempts taken to guess the correct candy.