Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNathan Wieters
1,415 PointsSince when does there need to be parentheses at the end of the print statement in python????
I am fairly new but have been working in python for a few weeks now... I havnt been using the parentheses this whole time and now its a syntax error in workspaces? tsup with that?
5 Answers
William Li
Courses Plus Student 26,868 PointsSince Python 3
Nathan Wieters
1,415 Pointsoooohhhhhhhh shoots, duh, thanks
William Li
Courses Plus Student 26,868 PointsHaha, yeah, you must be coming from Python 2.x. Me too. In Python 3, print
is a function.
Nathan Wieters
1,415 PointsDo you know why they changed that? print is used a lot, it seems weird they added 2 extra key strokes on it. What is the benefit of changing it to a function??
Ricky Catron
13,023 PointsThis page has a lot of reasons for why I should have been changed.
Goodluck! --Ricky
William Li
Courses Plus Student 26,868 PointsYeah, you're right, Python 3 has many new changes and features that are NOT backward compatible with Python 2, unless you do some extra work.
There's a way to make your print
cross-compatible with both Python 2 & 3.
from __future__ import print_function
once you has this import statement in your py
file, your print
function will behave exactly the same in both python 2 & 3.