Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Python by (47.6k 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?

closed

2 Answers

+2 votes
by (106k points)
edited 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.

To know more about this you can have a look at the following video:-

If You want to learn python for data science visit this Python Certification by Intellipaat.

0 votes
by (19k 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")

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

Browse Categories

...