Challenge: Make loopy function skip an item.
I cannot figure out this challenge. I've tried so many iterations of my code posted below, but nothing works and I cannot seem to figure out how to accomplish it.
"Same idea as the last one. My loopy function needs to skip an item this time, though.
Loop through each item in items again. If the character at index 0 of the current item is the letter "a", continue to the next one. Otherwise, print out the current member.
Example: ["abc", "xyz"] will just print "xyz"."
def loopy(items): for item in items: if item == "a".index(0): continue else: print(item)
You need your code to say if the item in the oneth place is equal to "a" continue. What your code says right now is: if "a" is at the index of zero continue. Hope this helps, Nakal
Thank you so much, nakalkucing! You explanation cleared it up. I was going by specific index on the list instead of thinking about how many items are in the list. Here was the end result:
def loopy(items): for item in items: if item == "a": continue else: print(item)