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 trialfahad lashari
7,693 PointsI haven't used continue, is it necessary? my code works just fine without it...
list_items = []
def show_help():
print("""Type "HELP" to see the available functions,
Type "SHOW" to show the current items on the list
Type "DONE" to quit the programme""")
def add_item(list_item):
list_items.append(list_item)
def print_list(list):
print("Current Items: ")
for items in list:
print(items)
def function():
#1*Run the script to start using it
show_help()
item = ""
while item!="DONE":
item = input('Add a task to be done: \n')
#2*Enter the word DONE in all caps to quit the programme
if item=="DONE":
#4*One I quit, I want the app to show me everything that's on my list
print_list(list_items)
break
#5I should be able to type "SHOW" to show what's current on the list
elif item=="SHOW":
print_list(list_items)
#6I should be able to all the functions such HELP, DONE and SHOW by typing "HELP"
elif item=="HELP":
show_help()
else:
#3*put new things into the list, one at a time
add_item(item)
function()
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi fahad,
Since you moved your add item code into an else block you wouldn't need the continue statements.
Kenneth needed them in order to skip over the add item code which was at the end of the loop and not inside an else block.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 Pointsadded syntax highlighting for python