get llop index python code example
Example 1: python enumerate for loop
presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for num, name in enumerate(presidents, start=1):
print("President {}: {}".format(num, name))
Example 2: iterate array python with index
for header, rows in zip(headers, columns):
print("{}: {}".format(header, ", ".join(rows)))