create small mini game
- User
create small mini game
Assistant
Here's a simple "Guess the Number" mini-game in Python. The computer picks a random number between 1 and 100, and the player has to guess it within a limited number of attempts.
Code:
import random def guess_the_number(): print("Welcome to 'Guess the Number'!") print("I'm thinking of a number between 1 and 100.") secret_number = random.randint(1, 100) max_attempts = 7 attempts = 0 while attempts < max_attempts: guess = int(input("\nYour guess: ")) attempts += 1 if guess < secret_number: print("Too low! Try higher.") elif guess > secret_number: print("Too high! Try lower.") else: print(f"Congratulations! You guessed it in {attempts} attempts!") return print(f"\nGame over! The number was {secret_number}.") # Start the game guess_the_number()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.