array = ["one","two","three","four"]
arrayOfNumbers = []
mainArray = []
for i, x in enumerate(array):
arrayOfNumbers.append(i)
mainArray.append(x)
'''
>>print(arrayOfNumbers)
>>[0, 1, 2, 3]
>>print(mainArray)
>>["one","two","three","four"]
'''
# enumerate
for index, item in enumerate(['sanjose', 'cupertino', 'sunnyvale', 'fremont']):
print(index, ':', item)
# 0 : sanjose
# 1 : cupertino
# 2 : sunnyvale
# 3 : fremont
>>> users = ["Test User", "Real User 1", "Real User 2"]
>>> for index, user in enumerate(users):
... if index == 0:
... print("Extra verbose output for:", user)
... print(user)