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 trialSoufiane Bdaoui
9,602 PointsHelp me understand the error in this phyton code challenge
I tried to search for similar problems but I really can't seem to understand the difference between my code and what other people used to pass the code challenge.
def loopy(items):
for item in items:
if item[0] == "a":
continue
else :
print(item)
3 Answers
olegovich7
6,605 PointsSoufiane, your code is fine, you just have two small typos:
- after if statement, continue should have 4 more spaces in front of it (indentation). Because there's no spaces it "continue" executes every single time with a loop and not when if statement is true
- after else statement you have a space before colon
olegovich7
6,605 PointsMaybe there is some extra space somewhere. Use this, passes challenge for me.
def loopy(items):
for item in items:
if item[0] == "a":
continue
else:
print(item)
Soufiane Bdaoui
9,602 PointsI finally understood that there was a problem with the indentation. Thanks guys.
Soufiane Bdaoui
9,602 PointsSoufiane Bdaoui
9,602 PointsThanks for the answer, sadly it's not enough to pass the code challenge. I got this error message:
Bummer! Didn't find the right items being printed.