from Guess_Game_art import logo
import random
numbers = list(range(1,101))
def random_number():
return random.choice(numbers)
def difficulty(user_difficulty):
if user_difficulty == "easy":
return 10
elif user_difficulty == "hard":
return 5
else:
print("Invalid input!")
num = random_number()
print(logo)
print("Welcome to the Number Guessing Game!")
print("I'm thinking of a number between 1 and 100.")
user_difficulty = input("Type 'easy' or 'hard': ").lower()
lives = difficulty(user_difficulty)
end = False
while not end and lives > 0:
user_guess = int(input("Make a guess: "))
guess_found = False
if user_guess == num:
guess_found = True
print(f"You got it! The answer was {num}.")
end = True
break
elif user_guess > num:
print("Too High")
elif user_guess < num:
print("Too low")
lives -= 1
if lives > 0:
print("Guess again.")
print(f"You have {lives} attempts remaining to guess the number.")
else:
print(f"You've run out of guesses, you lose!")
print(f"The answer was {num}.")
end = True
logo = r"""
_____ _____
/ ___/_ _____ ___ ___ / ___/__ ___ _ ___
/ (_ / // / -_|_-<(_-< / (_ / _ `/ ' \/ -_)
\___/\_,_/\__/___/___/ \___/\_,_/_/_/_/\__/
"""