Whats the error nd what to do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whats the error nd what to do?

number = input("any number:") if number > 0: print('Lemon hooslo')

21st Nov 2018, 3:11 AM
Prakhar Sharma
Prakhar Sharma - avatar
1 Answer
+ 6
As the input function converts whatever is entered by the user into a string, trying to compare it to an integer would only return an error. You would need to convert the input to an integer (by surrounding input() in int()) to get it to work.
21st Nov 2018, 3:29 AM
Faisal
Faisal - avatar