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 trialritvarstihomirovs
555 PointsMy loopy function needs to skip an item this time, though
Same idea as the last one. My loopy function needs to skip an item this time, though.
Loop through each item in items again. If the character at index 0 of the current item is the letter "a", continue to the next one. Otherwise, print out the current member.
Example: ["abc", "xyz"] will just print "xyz".
Can you tell me where am I wrong?
def loopy(items):
for item in items:
if item[0] == 'a'
continue
elif:
print(item)
2 Answers
Niko Klanecek
3,152 PointsAlso I just realized you are using continue
. It should not be used in this case. The body of your for loop should only have 1 statement like:
if item[0] != 'a':
print(item)
Niko Klanecek
3,152 PointsYou would only use elif
if you were testing an additional condition. Since you are not, you should replace it with else
.
ritvarstihomirovs
555 PointsOkay, thanks for letting me know. Anyways, that's not actually solving my problem.