enumerate
#for i,lol in enumerate(list(range(100))):
#if lol == 55:
#print(f'index of 55 is: {i}')
mi_lista = ["a", "b", "c","d","e"]
for i, element in enumerate(mi_lista):
print(f'index: {i}, element:{mi_lista}')
#Change the starting index(the default is 0)
#By default, enumerate starts counting from 0. But you can change it.
fruits = ["apple", "banana", "cherry"]
#start counting from 1
for i, fruit in enumerate(fruits, start=1):
print(f"indice:{i}, fruit:{fruits}")
#You only need the index, not the element
#Sometimes all you care about is the index number.
my_list = ["a", "b", "c","d","e"]
for i,_ in enumerate(my_list):
print(f'Im in the position:{i}')
#You only need the element, not the index (but you use enumerate for a reason)
my_list = ["a", "b", "c"]
for _, shopping_list in enumerate(my_list):
print(f'the element is: {shopping_list}')
INFO