Jan-27-2019, 08:18 PM
Hello,
What you need instead is
if "z" in testlist[index]This line checks if character "z" is in the string "testlist[index]", not if the string is "z". So "pizza" will be True.
What you need instead is
if "z" == testlist[index]You also don't need and index to iterate a list. You can simply do it like this:
my_list = ['a', 'b', 'c'] for item in my_list: print(item)And instead of "continue", you will need a "break" when the condition is met.