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!

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 trial

Python

Are parameters simply placeholders in a function?

I want to make sure I understand this conceptually. This video defines the function "yell" with a "text" parameter. Is this simply a placeholder?

I tried changing it to blue in the code I wrote and it seems to work the exact same way. What exactly is this parameter telling the machine to do? Could it easily just be empty or a single character? Does the machine understand the word "text" and expect some text to be entered?

Thanks in advance!

1 Answer

Steven Parker
Steven Parker
225,742 Points

You're exactly right. The parameter is simply a placeholder for the value that will be supplied as an argument when the function is called.

Any valid identifier (a mix of letters, numbers, and underscore symbols) can be used as a name, though "best practice" is to use a word that relates to what purpose the value will be used for.