names = ['aa', 'bb', 'cc', 'dd']
for name in enumerate(names):
print(name)
# (0, 'aa')
# (1, 'bb')
# (2, 'cc')
# (3, 'dd')
print("")
for index,name in enumerate(names):
print(index+1,name)
# 1 aa
# 2 bb
# 3 cc
# 4 dd
print("")
product = [('iphone',8000),('mac book',12000),('book',80),('pen',40),('bike',600)]
for name in product:
print(name)
print("")
for index,name in product:
print(index,name)
print("")
for index,name in enumerate(product):#index名字任意写,用于输出索引值
print(index,name)