else Question (python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

else Question (python)

Can somebody please correct my code? age = int(input()) name = input() if age>=18; print("Welcome " , name) else: print("Sorry") I don't understand what's wrong with it. I've tried adding the + sign and it's still incorrect.

21st Jun 2022, 7:27 PM
Ayesha Tajalli
4 Answers
+ 1
Oh, disregard wht I said before! You have a syntax error. It should be age>=18: There's a big difference between the colon ":" and semicolon ";".
21st Jun 2022, 7:30 PM
Justice
Justice - avatar
+ 1
OH THANKS
21st Jun 2022, 7:31 PM
Ayesha Tajalli
0
I have tried to add the plus sign but it doesn't affect anything?
21st Jun 2022, 7:29 PM
Ayesha Tajalli
0
No problem! Sorry for misleading in the beginning LOL. Syntax errors escape me all the time haha.
21st Jun 2022, 7:31 PM
Justice
Justice - avatar