Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python print statement “Syntax Error: invalid syntax” [duplicate]

People also ask

Why is Python saying my print is invalid syntax?

If the interpreter can't parse your Python code successfully, then this means that you used invalid syntax somewhere in your code. The interpreter will attempt to show you where that error occurred. When you're learning Python for the first time, it can be frustrating to get a SyntaxError .

How do you print a statement in Python?

The print() function prints the specified message to the screen, or other standard output device. The message can be a string, or any other object, the object will be converted into a string before written to the screen.


In Python 3, print is a function, you need to call it like print("hello world").


Use print("use this bracket -sample text")

In Python 3 print "Hello world" gives invalid syntax error.

To display string content in Python3 have to use this ("Hello world") brackets.