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 trialRyan Holliday
1,984 PointsNeed help with Loopy code challenge
def loopy(items):
for item in items:
if items[0] == 'a':
continue
else:
print(items)
I am not sure why this is not passing, It is saying that the right items are not printing. Any help would be appreciated. Thanks
def loopy(items):
for item in items:
if items[0] =='a':
continue
else:
print(items)
1 Answer
Michael Hulet
47,913 PointsThe challenge asks you to continue
if the object at index 0
of the current item is "a"
. Your code is checking if the object at index 0
of all the items
is 0
. Your code has the same problem in the print
statement at the bottom. If you change items
to item
(the variable of the for
loop that changes each iteration) in the condition and the print
statement, your code should pass
Ryan Holliday
1,984 PointsRyan Holliday
1,984 PointsWow, That worked. Thank you Michael!!