Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python loop with index

presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for num, name in enumerate(presidents, start=1):
    print("President {}: {}".format(num, name))
Source by treyhunner.com #
 
PREVIOUS NEXT
Tagged: #python #loop #index
ADD COMMENT
Topic
Name
8+2 =