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 Python Collections (2016, retired 2019) Lists Shopping List Take Three

huyen nguyen
huyen nguyen
850 Points

what's the purpose of adding "show_list()" command? How does the computer process the command"

why did he put the command at the end of the function? I"m very confused. Please help

1 Answer

Dariy Kutelov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dariy Kutelov
Front End Web Development Techdegree Graduate 21,706 Points

Show_list() at the end of the functions prints the full list including the last added item at the set position.

The show_list() in the beginning of the function prints the list before the last item is added that is useful when you add some tasks, than call 'help' for example and than continue to add tasks. It will print the existing list before it ask for the position of the new added task after the interruption of 'help'. If you add items without interruption (of 'help') you get the same result if you comment out the show_list() in the beginning of the function.