1items=['baseball','basketball','football']
2for index, item in enumerate(items):
3 print(index, item)
1for index, item in enumerate(items):
2 print(index, item)
3
4#if you want to start from 1 instead of 0
5for count, item in enumerate(items, start=1):
6 print(count, item)
1colors = ["red", "green", "blue", "purple"]
2
3for i in range(len(colors)):
4 print(colors[i])
5
1colors = ["red", "green", "blue", "purple"]
2i = 0
3while i < len(colors):
4 print(colors[i])
5 i += 1
6
1presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
2for i in range(len(presidents)):
3 print("President {}: {}".format(i + 1, presidents[i]))
4