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 trialSam Peck
773 PointsKeep getting a syntax error on line 4
I can't seem to figure out why continue is not "properly in the loop"
def loopy(items):
if items[0] == "a":
continue
else:
print(items)
2 Answers
Nathan Tallack
22,160 PointsYeah, the wording for this challenge is a little confusing. I had to read it a few times until I understood what they are asking.
They are going to give you a LIST of items. You will look at each item in the list and check if the first character in that item is the letter a and skip printing it if it is.
Your code would looke like this.
def loopy(items):
for item in items:
if item[0] == "a":
continue
else:
print(item)
Sam Peck
773 PointsOooh gotcha. Looks like the only thing I was missing was "for item in items:". I thought that wasn't needed because i didn't see a list name to reference.
Thank you very much!
Nathan Tallack
22,160 PointsYup, and to look at and print item not items once you are inside the loop.
I made the same mistake, so don't be too hard on yourself. :)