import random # Seed the random number generator random.seed() # Start the loop loop = True while loop: # Generate a random number between 0 and 5 computer_choice = random.randint(0, 5) # Ask the user for input try: user_choice = int(input("Please input a number from 0 to 5: ")) if 0 <= user_choice <= 5: if computer_choice == user_choice: print("Nice! You guessed it!") loop = False else: print(f"Nope! Computer chose {computer_choice}. Try again.") else: print("Please enter a valid number between 0 and 5.") except ValueError: print("That's not a number! Please enter a number between 0 and 5.")