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 trialyannis sousanis
7,199 PointsI need some help here too....
What is wrong?
def loopy(items):
for item in items:
if items[0] == "a":
continue
else:
print(items)
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! When doing a for in
loop the word after the for
is a temporary variable name for an individual item in the iterable that you're looking at. Like for singer in artistsList
would go down a list of artists and every one it looks at would be named singer
for the execution of that loop.
You've almost got it except that you're trying to compare the entire list of items instead of the item
.
So the last part should be:
if item[0] == "a":
continue
else:
print(item)
Here we compare the first letter of the individual item. If it's "a" we continue, otherwise we print out the item.
Hope this helps!
yannis sousanis
7,199 PointsThank you again for saving me