Answers for "for get index python"

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

for loop with enumerate python

presidents = ["Washington", "Adams", "Jefferson"]
for num, name in enumerate(presidents, start=0):
    print("President {}: {}".format(num, name))
Posted by: Guest on June-25-2020
2

python get index and value from list

test = [ 'test 1', 'test 2', 'test 3' ]
for index, value in enumerate( test ):
  print( index, value )
Posted by: Guest on October-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language