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
Virochaan Ravi6,940 Points
Don't Understand CHallenge
Please help me understand and see the code involved in this challenge
# 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:
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
for item in items:
if item == 'a':