Answers for "how to iterate through array python with index"

4

python for loop array index

colors = ["red", "green", "blue", "purple"]
i = 0
while i < len(colors):
    print(colors[i])
    i += 1
Posted by: Guest on August-29-2020
0

python iterate with index

for index, item in enumerate(iterable, start=1):
   print index, item
Posted by: Guest on November-27-2020

Code answers related to "how to iterate through array python with index"

Python Answers by Framework

Browse Popular Code Answers by Language