Answers for "for loop enumerate python"

4

how to use enumerate in python

rhymes=['check','make','rake']
for rhyme in enumerate(rhymes):
    print(rhyme)
#prints out :
(0, 'check')
(1, 'make')
(2, 'rake')
#basically just prints out list elements with their index
Posted by: Guest on June-26-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

Python Answers by Framework

Browse Popular Code Answers by Language