If x
is a sequence of elements, when you do
for i in x:
you are looping through the elements of x
, not through indexes.
So when you do
x[i]
you are doing
x[element]
which makes no sense.
What can you do?
You can compare the element with 'fizz'
:
for element in x:
if element == 'fizz':
# ...