Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Continue

I do not understand what the challenge is asking. Is there another way to ask the challenge? The wording is confusing.

I have tried different working versions of code. However, I do not understand what the challenge is asking for. If I read word for word then here is what I interpret.

Loop through items to look at each member If the member is an "a" then continue to the next member If it is not an "a" then print all the items

This would result in printing the list for each member in items that is not an "a". The wording of the challenge is not clear to me.

1 Answer

Kourosh Raeen
Kourosh Raeen
23,732 Points

You need to loop through the items list. Inside the loop you use an if statement to see if the current item in the loop starts with an "a". If it does you skip by using the continue keyword, otherwise you print that item. In the end, you end up printing only those items in the list that start with an "a". Here's the code:

def loopy(items):
  for item in items:
    if item[0] == "a":
      continue
    else:
      print(item)

Thanks for the answer. I did figure it out and completed the challenge.