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 Introducing Lists Build an Application Display the List

Why does 'add_to_list' function take an argument of 'item' but 'show_list' doesn't?

Both functions are using item, one is adding the item to the list, the other is printing the item. They both need item, so why isn't item passed to 'show_list'

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,250 Points

It's hard to say too much without the code you're trying, but it sounds like you're asking about variables passed to function arguments.

Just glancing at the video I think what's happening is show_list(): is using list object that is in the global scope so that is the variable it is using. And the data that is appended and used in another function. In show list, item` is a tracking variable that displays each value as it is looped over.

Remember that variables passed as parameters to a function are placeholders for information passed in a function call.