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 trialOtto Beyer
5,096 PointsCode solution doesn't seem to be working. Tested my solution in the Python shell and appears to work perfectly.
def loopy(items):
# Code goes here
for item in items:
if item[0] == "a":
continue
print(item)
items = ['apple','pear'] loopy(items);
3 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsSo very close. Your print statement is not inside your for
loop so it only prints once.
def loopy(items):
# Code goes here
for item in items:
if item[0] == "a":
continue
print(item) # <-- indent
Vittorio Somaschini
33,371 PointsHello Otto.
I have edited your question with the code properly formatted now.
Talking about the issue you are having here, I see you are missing the "else" statement to cover the other case (where item[0] is not the letter a)
Vitto
Chris Freeman
Treehouse Moderator 68,441 PointsThe else
is not strictly needed in this case.
Otto Beyer
5,096 PointsDear Chris and Vittorio,
Thank you for the feedback. I feel so silly not getting the indentation right. How green of me...
Apologies also for the quality of my question. I didn't realize that I was submitting the question to forum otherwise I would have framed in the appropriate structure.
Best regards Otto