Hello,
I want to write a small program that outputs the age difference in years to 18:
I get the following error message:
I want to write a small program that outputs the age difference in years to 18:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x = int ( input ( "Please enter your age: " ) if x > 18 : y = x - 18 print ( "You are" + int (y) + "year(s) older than an 18 year old." ) elif x < 18 : y = 18 - x print ( "You will turn 18 in" + int (y) + "years" ) elif x = = 18 : print ( "You are the perfect age" ) else : print ( "incorrect value entered." ) |
Error: File "/home/pc/PycharmProjects/begin/howfar18.py", line 3
if x > 18:
^
SyntaxError: invalid syntax
Process finished with exit code 1
Thank you for your help.