Downloads · 30 days
0
aleenalai/Games
Games is a machine learning model from aleenalai. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Mar 8, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 53%
From the Hugging Face model README
import random
def guess_number(): # Generate a random number between 1 and 100 secret_number = random.randint(1, 100)
# Initialize the number of attempts
attempts = 0
print("Welcome to the Guessing Game!")
print("I'm thinking of a number between 1 and 100. Can you guess what it is?")
# Start the game loop
while True:
# Get the player's guess
guess = input("Enter your guess (or 'q' to quit): ")
# Check if the player wants to quit
if guess.lower() == 'q':
print("Thanks for playing! The secret number was:", secret_number)
break
# Convert the guess to an integer
try:
guess = int(guess)
except ValueError:
print("Please enter a valid number or 'q' to quit.")
continue https://hdpcgames.com/genshin-impact-highly-compressed-download
# Increment the number of attempts
attempts += 1
# Check if the guess is correct
if guess == secret_number:
print("Congratulations! You guessed the secret number in", attempts, "attempts!")
break
elif guess < secret_number:
print("Too low! Try again.")
else:
print("Too high! Try again.")
guess_number()