sorted(), reversed(), enumerate(), zip() : loop through « Tuple « Python Tutorial






albums = ('A', 'B', 'C', 'D')
years = (1976, 1987, 1990, 2003)
for album in sorted(albums):
     print album,
for album in reversed(albums):
     print album,
for i, album in enumerate(albums):
     print i, album

for album, yr in zip(albums, years):
     print yr, album








6.7.loop through
6.7.1.Making tables using lists of lists and tuples of tuples.
6.7.2.sorted(), reversed(), enumerate(), zip()