I think you’re just misunderstanding how the for ... in
loop works. i
is assigned each element of the dog_breeds
list (assuming it is a list) one at a time. i
is NOT assigned the index
of the element. The value of i
will be of whatever type each element of the dog_breeds
list is when assigned. Look at this example:
dog_breeds = ['doberman', 'collie', 'daschhund', 7, False]
for i in dog_breeds:
print('value: {} type: {}'.format(i, type(i)))
Output:
value: doberman type: <class ‘str’>
value: collie type: <class ‘str’>
value: daschhund type: <class ‘str’>
value: 7 type: <class ‘int’>
value: False type: <class ‘bool’>