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 trialAshley Keeling
11,476 Pointsdoes any one know why this code isn't working
I don't know why it isn't working
def loopy(items):
for item in items:
if item =="a":
continue
print(item)
3 Answers
Steven Parker
231,236 PointsThe instructions say to skip If the character at index 0 of the current item is the letter "a".
That's another way of saying "if the first letter is a". But this code only skips an item if the name is exactly "a".
Since you only asked why it isn't working I assume you don't want a spoiler and can take it from here.
Oszkár Fehér
Treehouse Project ReviewerHi Ashley, The loop it's ok and it will print out the correct answer but just in case of characters, list of characters. The quiz mentions that If the character at index 0 of the current item is the letter "a", which it means every string what starts with the character "a", it's a little bit tricky. So we can call this method:
if item.startswith('a', 0): <---letter 'a' at index 0--->
continue
I hope this will help you.Happy coding
Ashley Keeling
11,476 Pointsthanks
Steven Parker
231,236 PointsGlad to help. And happy coding!
Ashley Keeling
11,476 PointsAshley Keeling
11,476 Pointsthanks for the help