+ 2

Why won’t these if and else statements work???

https://code.sololearn.com/c40w825EgmNs/?ref=app Run this code and type a question that starts with “can” or “will” (eg.can cats fly?). The code should respond with a yes or no answer...but it doesn’t?!? The else statement also won’t run!?! https://code.sololearn.com/c40w825EgmNs/?ref=app

20th Apr 2018, 10:54 PM
James Pinder
5 Respuestas
+ 5
It works if you change your code to this: if (pick == 1): print ("yes") elif (pick == 2): print ("no") elif (pick == 3): print ("obviously!") elif (pick == 4): print ("don't think so...") elif (pick == 5): print ("maybe, I'm not really sure...")
20th Apr 2018, 11:02 PM
Emma
+ 4
Thanks Xan
20th Apr 2018, 11:36 PM
James Pinder
+ 2
Didn’t realise I had forgotten to change the if statement when I copied and pasted
20th Apr 2018, 11:39 PM
James Pinder
+ 1
Easily done ☺
21st Apr 2018, 3:35 AM
Emma
0
So simple and for some reason entertaining, haha. Because python is case-sensitive though, any inputs beginning in a capital letter does not run the code as they are not listen in the if-statement!
24th Apr 2018, 8:18 AM
Malachi Edwards
Malachi Edwards - avatar