Welcome to the Treehouse Community
Looking to learn something new?
Virochaan Ravi6,940 Points
Don't Understand CHallenge
Please help me understand and see the code involved in this challenge
def loopy(items): # Code goes here
This challenge is actually quite similar to the earlier
break challenge. The only difference is that you have to check a specific letter of the item, rather than the item itself. And that you have to use the
continue keyword instead of the
continue keyword simply makes the loop skip an item. Pulling out a specific letter in a string can be done in the same way you pull out a specific item in a list by simply using bracket notation.
Here is an example of the solution:
def loopy(items): for item in items: # Loop though the items list if item == "a": # Pull out the first letter of the item string (indexes start at 0) continue # Continue if the first letter is "a" print(item) # Print the item if that is not the case
If there is something you'd like more details on, or if you are still confused then feel free to ask me follow up questions, I'd be happy to answer anything I can.
#they are asking you to loop the argument 'items ' #if the first character is 'a' pass, always the first character will at the index 0 #when It find an "a" just pass it def loopy(items): for item in items: if item == 'a': pass else: print(item)