Answers for "python loop index array"

27

python3 iterate through indexes

items=['baseball','basketball','football']
for index, item in enumerate(items):
    print(index, item)
Posted by: Guest on May-07-2020
1

python array looping

array = ["Var1","Var2","Var3"]
for i in range(len(array)):
  print(array[i])
  
#Output#
#Var1
#Var2
#Var3
Posted by: Guest on March-07-2020
0

python for loop index

# Creates two variables; An index (num), and the value at that index (line)
for num, line in enumerate(lines):
    print("{0:03d}: {}".format(num, line))
Posted by: Guest on October-16-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

Code answers related to "python loop index array"

Python Answers by Framework

Browse Popular Code Answers by Language