+ 1

How do you test if your input number+10=19?

I tried: input () if (input)+10=19:print('Yes!') else:print('nope') but I still get a SyntaxError. And I still inputed the 9

9th Oct 2017, 11:06 PM
Lux Official
Lux Official - avatar
2 Answers
+ 2
if int(input())+10==19:print("Yes!") else:print("nope") #this is the correct code
9th Oct 2017, 11:27 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
1. input is a function. If you wanna store the value, store it under a separate variable name. 2. = is the assignment operator in Pythpn, not an equality checker. The rquality checker is == 3.input() returns a string, not an integer. If you want an integer, you must convert it to one.
9th Oct 2017, 11:29 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar