Is there something wrong with this code?


#1

Is there something wrong with this code.

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:
  print random_number
  guess = int(raw_input("Your Guess: "))
  if guess == random_number:
    print "You Win!"
    break
  guesses_left -= 1
else:
    print "You lose."

How should my while/else be indented?
#2

That line will not be expected by the lesson checker.


#3

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