N/APosted on - 08/19/2014
This error tells me that I have entered an invalid syntax. I am a newbie using Python but I have followed a tutorial and this syntax worked just fine there. Can anyone tell me please what I did wrong ? Why is not working like in the tutorial ?
There’s an error in your program: invalid syntax.
Python error writing good syntax in program
You followed the tutorial, alright, but the way you typed the command to display “blah blah” on the screen is incorrect and that causes the syntax error. To print a text on the screen or to display a message using the print statement in Python, the text to be printed should be enclosed in double quotes and ending the line with a semicolon. For example:
Print “First time on Python.”;
This line, when executed in Python, will display the message:
If you are using Python 2.4.3, this is how you properly write or use the print statement. But if you are using the new version of Python or the latest version, the message together with the quotes should be enclosed inside a parenthesis. When using a new version, the command or line above will be written as:
Print (“First time on Python.”);
The line is also terminated with a semicolon and will have the same output message as displayed above. So, to fix your problem, that line should be written as: