Help, input does not work | SoloLearn: Learn to code for FREE!


Help, input does not work

hello everyone I’m trying to run this python code, I’m a beginner and it’s a very simple code but it does not work it gives an error can someone help me solve this thank you so much age = input(“how old are you?”) if age > 10: print(“you are old”) else: print(“you are young”)

6/19/2019 3:15:48 AM


8 Answers

New Answer


Alex You have to use int() because your input is string and you have to convert it to integer. Why? Because in the line : if age > 10 you are comparing two numbers. You can't compare string and number. With integers you can do math, with string not exactly. Try these examples to see the difference between string and integer: print("2+2") print(2+2)


There are two things. First, you need to convert your string input to integer. Second, in Python, indentations are important, add them after if condition and else. Here: age = int(input("how old are you?")) if age > 10: print("you are old") else: print("you are young")


thank u voja !


thank you voja ! you are the best ;)


Can you say what the error is?


He already explained your error It's there age= ERROR(input(....


can you explain why i need to use int ? int()


Second line of voja