0

Hot Cold using ELIF

I'm new to python. Just finished the section of ELIF. I was thinking that with this command I should be able to set up something like a hot cold game. Currently I'm just trying to run the code to give me the correct answer based on the number I input then I will try building in warmer or colder as I get closer to the chosen number. Why does this not work? Is it even possible with ELIF? x=input elif x == 3: print('correct') elif x > 3: print ("too high") elif x < 3: print('too low')

21st Feb 2020, 9:22 PM
James Burier
James Burier - avatar
3 Respostas
+ 4
x=input() if x==3: print("correct") elif x>3: print("too High") elif x<3: print('too low') else: #código o lo que sea
21st Feb 2020, 9:31 PM
Cmurio
Cmurio - avatar
0
I forgot the ()
21st Feb 2020, 9:37 PM
James Burier
James Burier - avatar
0
I updated the code. I'm getting this error. Traceback (most recent call last): File "./Playground/file0.py", line 4, in <module> elif x > 3: TypeError: '>' not supported between instances of 'str' and 'int'
26th Feb 2020, 4:45 PM
James Burier
James Burier - avatar