It says invalid syntax but i dont know what is wrong.
Your program has some silly errors.
line 5, you have:-
if age - 18 = 1
You have two erros as of now.
First one is of opperator, Second one is of Syntax of If statement
You will now need to change this:
= to this:
and at the end of the Statement, you should add a colon
: in order to get rid of that errors.
line 5 should like this:-
if age - 18 == 1:
This may clear out all the errors
Hope this helps
You forgot an
=. To compare statements, you must use
print("hello") age = int(input("how old are you?")) if age > 17: if age - 18 == 1: print("you are an adult for 1 year") else: print("you are an adult for", 18-age, "years") else: if 18 - age == 1: print("you will be an adult in 1 year") else: print("you will be an adult in", 18 - age, "years")