Loops

Range without index

cheeses = ['Cheddar', 'Edam', 'Gouda']
for i in cheeses:
	print(i)

Range with Index + Step

my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

for i in range(0, len(my_list), 2):
    print(i)

Range from 0 => 5

#Go equivalent for (int i = 0; i < 5; i++)
for i in range(0, 5):
    my_list.append(i) # Each append takes O(1) time. Just like a stack.

Ranging through list with index

cheeses = ['Cheddar', 'Edam', 'Gouda']

for i in range(len(cheeses)):
    print(i, cheeses[i])

While

pets = ["dog", "cat", "bird", "turtle"]
i = 0
while i < len(pets):
    print(pets[i])
    i += 1 #i = i + 1

How to loop with indexes in Python