Loops 8/19


#1
from random import randint
guesses_left = 3
# Generates a number from 1 through 10 inclusive
random_number = randint(1, 10)

while guesses_left > 0:
  guess = int(raw_input("Your guess: "))
  guesses_left -= 1

  if guess == random_number:
    print "You win!"
    break
 
  
  
else: 
  print "You lose."

Why is my code not working and getting stuck all the time?


#2

get stuck how? Fail to input numbers? Maybe show a screenshot where you get stuck?


#3

Your guess: Traceback (most recent call last):
File “python”, line 7, in
ValueError: invalid literal for int() with base 10: ‘RUN’

This is the error message that I am getting


#4

that is a bug, try refreshing the page/different browser.

This bug is keep coming back for some reason, not sure why


#5

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