I have a coding question it originally comes from another app that teaches python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a coding question it originally comes from another app that teaches python

age=int(input("Enter your age")) If age>=18: Print("Congratulations,you are eligible to vote") (In pythonX app it states output as) Enter your age:19 Congratulations,you are eligible to vote When I write this code in python extension or Linux terminal & VS code On my Dell chromebook 3189 I get Invalid syntax

12th May 2023, 6:11 AM
Armand Beaulieu
Armand Beaulieu - avatar
3 Answers
+ 7
Did the error message refer a line number? or even better, refer the part of the code that triggered the error? I presume the capitalization of first letter in `if` and `print` was auto-capiitalization feature from your keyboard?
12th May 2023, 7:31 AM
Ipang
+ 6
As Ipang said, if you were to put that in any other compiler, it will give such an error with the capitalised If and Print. You can try it in the code playground and if it still doesn't work, paste that codebit here.
12th May 2023, 8:07 AM
Ausgrindtube
Ausgrindtube - avatar
+ 6
Does your task only requires "if statement" or is there anything to add up for "else" ? Why you are getting invalid syntax? Check the error again as Ipang & Ausgrindtube said. Share complete details for your given task & your code created in Sololearn playground.
12th May 2023, 4:12 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar