Python Program to Access Index of a List Using for Loop
# Python Program to Access Index of a List Using for Loop
sample_list = ["Welcome", "to", "the", "fascinating", "world", "of", "Python"]
for index, val in enumerate(sample_list):
print("index:", index, "| value:", val)
Output:
index: 0 | value: Welcome
index: 1 | value: to
index: 2 | value: the
index: 3 | value: fascinating
index: 4 | value: world
index: 5 | value: of
index: 6 | value: Python