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 trial

Python Functions, Packing, and Unpacking Getting Info In and Out of Functions Recap of Getting Info In and Out of Functions

João Robalo
João Robalo
1,028 Points

Can't we assign a default value to the parameter? Question seems to imply this is false.

Based on the question 4 of the quiz, "Parameters are not assigned a value until the function is called with an argument", the answer is "True". I thought it would be false, since you can assign default values when creating a function, so it would be a parameter with a value.

Erlend Dybvik Indrelid
Erlend Dybvik Indrelid
5,843 Points

Hi! Yes, it is correct that you can assign a default value to the parameter before calling the function, which results in you not needing to pass an argument when calling the function. The default parameter is however always overridden if you pass a value to the function. The reason to why the answer is True, is because you can imagine that you pass an argument to the function by relying on the default value. I guess the answer is a bit unclear on what it asks for, and I understand the confusion!

1 Answer

Steven Parker
Steven Parker
229,608 Points

The significant part of the sentence is "until the function is called", which is always true. The rest of the sentence either doesn't take into account the possibility of a default, or considers the default to be "passed" when an explicit argument is not provided.

If you still consider it misleading or unclear, you might want to submit a bug report to the Support staff. If they agree and change the question, you'll get an "Exterminator" :beetle: badge for discovering it.