forによる反復処理
普通の流ループ処理
rabbits = ['Flopsy', 'Mopsy', 'Cottontail', 'Peter']
current = 0
while current < len(rabbits):
print(rabbits[current])
current += 1
結果
Flopsy
Mopsy
Cottontail
Peter
Pythonらしコード
rabbits = ['Flopsy', 'Mopsy', 'Cottontail', 'Peter']
for rabbit in rabbits
print(rabbit)
結果
Flopsy
Mopsy
Cottontail
Peter