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


Matthew Daugherty
Matthew Daugherty
Courses Plus Student 3,039 Points

Why .format(item)?

In shopping_list_3.py, on line 66, we set variable new_item = user input. On line 26, we format the above string to .format(item)). Why is it not .format(new_item))? I am confused because on shopping_list_2.py the function is,

def add_to_list(new_item):

And on shopping_list_3.py the function is,

def add_to_list(item)

Can someone please explain this to me? What do those arguments do?

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The name of the parameter can be almost anything you wish. It is simply a reference to whatever argument is passed to the function. The parameter name could just as easily be matt.