Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

for loop with index python

presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for i in range(len(presidents)):
    print("President {}: {}".format(i + 1, presidents[i]))
Source by treyhunner.com #
 
PREVIOUS NEXT
Tagged: #loop #index #python
ADD COMMENT
Topic
Name
6+3 =