8. Your own while/else


#1


  1. your own while/else

if guess = 3

invalid syntax


Replace this line with your 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 count > 0:
    guess = int(raw_input("Your Guess Here: "))
    if guess = 3:
        print "You lose!"
        guess_left -= 1
        break
else:
    print "You Win!"


#2

This line:

if guess = 3

you want to compare, use 2 equal signs, a single equal sign is for assigning a value to a variable


#3

Thank you, that worked. It didn't before but I understand... so for conditional statements, there must be a comparison? or not always?


#4

you must have done == before, it is impossible you didn't. Yea, you need to compare, or you can do: if True:, that will also work, then the condition is True as well