+ 2

Whats wrong here?

Why isnt it calling the function if the userinput is 1? https://code.sololearn.com/c2Fy781nzEmK/?ref=app

20th Apr 2019, 5:23 AM
Zinnur Hossain
Zinnur Hossain - avatar
2 Respostas
+ 3
userinput is a string, so you either need to check if userinput == '1' or convert it to an integer: userinput = int(input("Press 1 to attack, 2 to defend: "))
20th Apr 2019, 6:03 AM
Anna
Anna - avatar
0
Anna ah, i see! Thanks once again! Also, is it okay if I make a post everytime i run into a problem about something? Like, i will try and find the problem on my own but most times i cant so i end up asking the forums a lot. Is that recommended? Or is it like spamming, which i dont wanna do at all.
20th Apr 2019, 6:16 AM
Zinnur Hossain
Zinnur Hossain - avatar