Answers for "pyrthon loop aray and 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 for looop array value and index

cars = ["tesla", "audio" , "bwm", "VW", "seat"]

for i , value in enumerate(cars):
  print(f'value is: {value}, and index = {i}')
Posted by: Guest on August-11-2021

Python Answers by Framework

Browse Popular Code Answers by Language