I'm trying to make a simple program where I'm asking to user to put name
and age
and after that using if else to print the result.
I want when is put age 20 so result should come
Congratulation Edit your age is 20 and you can find the truth
but It is not working here is the code which I'm using.
Code
name = input("what is your name \n")
print('Nice to meet you', name, "!!")
age = input("Your Age ? \n")
if age > 18:
print('Congratulation ' + name + ' your age is '+ str(age), ' and you can find the truth ')
else:
print('Sorry ' + name + 'your age is '+ str(age), ' and you can also find the truth if you start from today')
and error which I'm getting after running my code.
Error
what is your name
Edit
Nice to meet you Edit !!
Your Age ?
20
Traceback (most recent call last):
File "C:/Users/hp/PycharmProjects/Project/input_user.py", line 5, in <module>
if age > 18:
TypeError: unorderable types: str() > int()
Help me out here to resolve this problem.