1for index, item in enumerate(items):
2 print(index, item)
3
4#if you want to start from 1 instead of 0
5for count, item in enumerate(items, start=1):
6 print(count, item)
1items_list = ["python","enumerate","function","with","custom","start"]
2
3custom_start = 1 # default_start = 0
4
5for index,item in enumerate(items_list, start = custom_start):
6 if index == 1:
7 print("index starts at {custom_start} with a stored value of {list_value}".format(custom_start=index, list_value=item))
8 else:
9 print("index continues as {} with a value of {}".format(index,item))
10
11