What mistake I am doing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
18th Jun 2017, 12:32 PM
Akash Desarda
Akash Desarda - avatar
4 Answers
0
By default input value is string. So if you want to compare values in if as int, you need cast x to int, like if int(x) < 10: Or if you need to compare this values as string, you need to cast 10 to string.
18th Jun 2017, 8:01 PM
shaldem
shaldem - avatar
+ 13
input() is used to scan a string. You should use int(input()) to scan an integer. Try this. x = int(input("enter a no")) if x < 10: print ("less than 10")
18th Jun 2017, 12:39 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
18th Jun 2017, 12:42 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Thanks for the help
19th Jun 2017, 12:47 AM
Akash Desarda
Akash Desarda - avatar