文書の過去の版を表示しています。
for range enumerate 文
range関数による繰り返し
In : range(5) Out: [0, 1, 2, 3, 4] for index in range(5): print('index: {0}'.format(index)) index: 0 index: 1 index: 2 index: 3 index: 4
enumerate関数によるリストの繰り返し
In : colors = ['red', 'blue', 'green', 'pink', 'white'] for index, color in enumerate(colors): print('color{0}: {1}'.format(index, color)) color0: red color1: blue color2: green color3: pink color4: white