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

Mit Sengupta
Mit Sengupta
13,823 Points

I am asked to move everything into the main function. So I did. show_help() # make a list to hold ont

But it isn't passing.

Here's my code:

def main(): 

  show_help()

# make a list to hold onto our items
shopping_list = []

while True:
    # ask for new items
    new_item = input("> ")

    # be able to quit the app
    if new_item == 'DONE':
        break
    elif new_item == 'HELP':
        show_help()
        continue
    elif new_item == 'SHOW':
        show_list(shopping_list)
        continue
    add_to_list(shopping_list, new_item)

show_list(shopping_list)
Ken Alger
Ken Alger
Treehouse Teacher

Edited for markdown

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Mit;

Double check your indentation in your main() method. If your indentation is correct throughout the entire method it will pass the challenge.

Happy coding,
Ken

This comment was not as helpful as the answer in this thread:

https://teamtreehouse.com/community/trouble-with-main-function

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

james white -

I appreciate your thoughts, but I tend to point people in a direction which will allow them to come to proper solutions on their own accord instead of giving away answers to the challenges. I find that it helps people learn more. Perhaps we have a different though process on the method of learning and assisting others in the process.

If you look over many of the responses I have provided here in the forums, if my initial response does not lead to an answer I continue to assist until an answer is found.

Thanks for all you do.

Ken