+ 3

Beginner code issues

Having trouble with my game 1 code it’s a guessing game an I can’t seem to figure out what’s wrong with elif

14th Apr 2018, 11:59 AM
Black Rose
Black Rose - avatar
3 Answers
+ 2
Try this instead import random n = random.randint(1,99) guess = input("enter an interger from 1 to 99:")) while n != "guess": print if guess <n: print ("guess is low,try again") guess = input("enter integer from 1 to 99:")) elif guess >n: print ("guess is high, try again") guess = input("enter integer from 1 to 99:")) else: print ("you guessed it") break
14th Apr 2018, 12:24 PM
Ariela
Ariela - avatar
+ 1
Your problem was with the spacing of the code, some missing parenthesis, and some missing quotation marks
14th Apr 2018, 12:25 PM
Ariela
Ariela - avatar
0
your problem is a missing space: elif only works if your still in an if statement: (# for spaces to make it better visible) #if : ##methods() #elif : but you made: #if : #methods() #elif : so it thinks the if part is completed with the methods() statement
14th Apr 2018, 12:25 PM
Aaron Eberhardt
Aaron Eberhardt - avatar