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!
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
Evan N3,244 Points
I don't fully understand why my program isn't actually printing the values up until "a" within my console
My code passes but I am not seeing the items print up until "a"
So, my understanding is that this program loops through the items until "a" and continues through the loop without stopping. However, even if I change the list to not include "a" the program will still not print to the console.
def loopy(items): for item in items: if item == "a" : continue else: print(item) items = ["z", "c", "a", "d"]
def loopy(items): # Code goes here
def keyword defines a function, but it does not run any of the code within it. In order to run the function you have to call it and pass it a list to work on.
Here is an example:
# Define loopy def loopy(items): for item in items: if item == "a" : continue else: print(item) # Call loopy with list as argument loopy(["z", "c", "a", "d"])
That will result in:
z c d
Being printed out.