seasons = [“Spring”, “Summer”, “Fall”, “Winter”]
lst = list( enumerate(seasons) ) #e- nu-me-rate: 列舉,羅列,歷數,遍歷
print( lst )
lst1 = list( enumerate(seasons,start=1) )
print( lst1 )
seasons = [“Spring”,”Summer”,”Fall”,”Winter”]
lst = list( enumerate(seasons) ) #e-nu-me-rate
print( lst )
lst1 = list( enumerate(seasons, start=1) )
print( lst1 )
for idx, sea in enumerate(seasons, start=1):
print(idx,sea)
print(“===一般for迴圈===”)
idx=1
for sea in seasons:
print(idx,sea)
idx += 1