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 trial

Python Python Basics (2015) Shopping List App Continue

Jean Apolo
Jean Apolo
3,494 Points

Am I supposed to have the code skip every iteration of "a" in the list when loopy function is run or just index 0?

Here's the code that I've written for this challenge:

def loopy(items): # Code goes here for item in items: #Goes though items list in loopy argument if items[0] == 'a': #Skip printing elements that are exactly "a" continue else: print(item) #Print everything else other than elements containing "a".

Here are the details of the challenge question: "Same idea as the last one. My loopy function needs to skip an item this time, though. Loop through every item in items. If the current item's index 0 is the letter "a", continue to the next one. Otherwise, print out every member of items."

I am confused about whether I should care about specifically index 0 or any "current" index that has only the letter "a" in general as then loopy function goes though the for loop? This function prints out every member of items except the items that have only the letter "a" but it did not like it. Is it the 0th index or any current index in general that the program needs to skip if it encounters the only letter "a"? The instructions for the second sentence of what this particular challenge task is ambiguous and needs more clarification.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I'm betting you can code this if you understand what they mean in the instructions. What they mean is that any item that has the first letter of "a" should be skipped. IE cut out any word that starts with the letter "a". If you're still stuck, I can post some code for you.