-2

I print my computer number so I can enter it into the player guess to make sure the value is true but when I enter it, it says the number is wrong. I am not sure why that is. Here is my code:


def start():

    computerNum = random.randint(1, 10)
    print(computerNum)
    playerGuess = input("Enter your guess: ")

    if playerGuess == computerNum:

        print("You got it! The number was " + str(computerNum))

    if playerGuess != computerNum:

        print("You are wrong, the number is " + str(computerNum))

startPlay = input("Would you like to play the game? ").lower()

if startPlay == 'yes':
    start()```
Josh
  • 1

1 Answers1

-1

cast computerNum to string or playerGuess to integer

Csen
  • 9
  • 4