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 Second Shopping List App

Jason Hitching
PLUS
Jason Hitching
Courses Plus Student 577 Points

while True: syntax error?

I'm getting a syntax error on my while True: part of code and i'm not sure why?

make a list to hold onto our items

task_list = []

print out instructions on how to use the app

def show_help(): print("What do you want to add to your to-do list?") print(""" Enter 'DONE' to stop adding items. Enter 'SHOW' to show the list of tasks. Enter 'HELP' to receive with the program. """)

def show_task(): print("Here's your list:")

for item in task_list:
    print(item)

def add_to_task(new_task):
task_list.append(new_task) print("Added {}. List now had {} items.".format(new_task, len(task_list)

while True: new_task = input("> ")

# be able to quit the program
if new_task == 'DONE':
    break

elif new_task == 'HELP':
    show_help()
    continue

elif new_task == 'SHOW':
    show_help()
    continue
add_to_task(new_task)

print()
show_task()

1 Answer

Steven Parker
Steven Parker
229,644 Points

You're missing some punctuation.

On the print line just before that while True:, there are more open parentheses "(" than there are closing ones ")". It looks like 2 more closing ones need to be added to put them back in balance.

In future questions, be sure to format your code so the spacing shows up (in Python, indentation is everything).
Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down: