Your own while / else help


Console giving error : File "python", line 10
numm = random.randint(1, 6)
SyntaxError: invalid syntax

Codecademy giving error
Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: invalid syntax (python, line 10)

from random import randint

# Generates a number from 1 through 10 inclusive
random_number = randint(1, 10)

guesses_left = 3
# Start your game!
while guesses_left > 0:
    guess = int(raw_input("Your guess: ")
    numm = random.randint(1, 6)
    if guess == numm:
        print("You win!")
        print("You lose.")
        guesses_left = guesses_left - 1

Thanks to anyone that helps!


Different error now, error:Oops, try again. Did you include an else for the while loop?


you should have a while/else, you currently have an if/else


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.