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 trialcatherine paris
2,705 PointsFunction definition
The code challenge referred to print() as a function. But I thought functions had to look like: def codeChallenge (): print("blah") and then be called later on????
So how is print() a function???
2 Answers
Christian Mangeng
15,970 PointsHi Catherine,
what you mean is the syntax with which functions are defined in Python. You define a function with
def function():
, but you call it with function(). In this sense, print() is no different, as you do not define it again but call it.
Christian Mangeng
15,970 PointsYes exactly
catherine paris
2,705 PointsThank you so much
catherine paris
2,705 Pointscatherine paris
2,705 Pointsok so print is a function that already exists in Python therefore it doesn't need to be defined. All the user has to do is call it in order to use it. Is explanation correct???