Why Does It Use This Syntax For Printing?


I’m just curious about something. Normally when we print we use print(“example”), but in exercise 14/14 at the end it asks " 6.

Print a string to the console that says:

I got X points!

with the value of point_total where X is.

now to sum it up it wants print"example" instead of print(“example”), why is that? Hopefully this question makes sense

FAQ: Learn Python – Python Syntax – Review
FAQ: Learn Python – Python Syntax – Review

so the question is purely about print?

there are two major versions of python (python2 and python3), in python2 print is a statement:

print "example"

while in python3 print is a function call:


inserting parentheses for print in python2 could give undesired behavior:

 print("i got", 5, "points")

a tuple is printed, while print "i got", 5, "points" gives a string.