+1 vote
1 view
in Python by (14.2k points)
edited by

When I try to use a print statement in Python, it gives me this error:

>>> print "Hello, World!"

File "<stdin>", line 1

print "Hello, World!"

^

SyntaxError: Missing parentheses in call to 'print'

What does that mean?

2 Answers

+2 votes
by (30.4k points)
selected by
 
Best answer

While running the above code if you are getting this “SyntaxError: Missing parentheses in call to 'print'”  error it means that you are using Python 3 so if you do not want to get this error run this code in Python 2:

print "Hello, World!"

If you are using Python 3 you need to add parentheses around the value to be printed like mentioned in the following piece of code:-

print("Hello, World!")

Another reason why you are getting that error is that the print () statement is a function in Python 3 and greater versions so you need to put the parentheses while in Python 2 and lower versions it is just a statement so there is no need of parenthesis.

0 votes
by (12.2k points)

Actually, the statement print "hello python" does not work in Python 3 because the print statement becomes a function in Python 3. So, in Python 3 you need to add parentheses around the value to be printed as below:

print("hello python")

...