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 Basics (2015) Shopping List App Refactor

awesometea
awesometea
2,266 Points

For the refactor exercise, would I just add def main(): to line 22? I'm not sure what I'm missing.

I'm not sure what I'm missing in the refactor exercise.

I tried adding def main(): to line 22 and calling the main function at the end. Is that not enough?

1 Answer

Modou Sawo
Modou Sawo
13,141 Points

Hi awesometea!

I think I see where the problem is...When you write the main func (def. main() - note no arguments), make sure everything else is inside and indented. NOTE: the show_list(shopping_list) line must be in-line with the while loop (while True:), and the "break" and "continue" are indented one more time (IF they have those red dots underneath them)

Here's a hint: you can open another tab on your browser window to view the original code w/o the main func., to compare the two.

But I think the issue is likely the alignment of the while loop and line 44 - the show_list(shopping_list) func.