Python Forum

Full Version: Hi everyone
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have this code, and for some reason the compiler sees the input() of (what's your age) as string, instead of integer.

what to do ?

i appreciate your help !

Tal

print('Hi mate, what is your name ?')

Name = input()

print('Hello ' + Name + ' its nice to meet you')

print('what is your age ?')

Age = input(int)

if ((Age >= 60) and (Age < 70)):

	print('I see you are in your 60s, thats a very good age to be, lots of wisdom')

else:
	print('your age is not within the paramaters')
Why are you passing the function int to input? You should be taking the return value of input and passing it to int. Also, note that input takes a string that is used as a prompt (so using print for the prompt is unnecessary), e.g.

age = int(input("How old are you?"))
thank you so much !