sorted(), reversed(), enumerate(), zip() : Loop through : Tuple PYTHON TUTORIALS


PYTHON TUTORIALS » Tuple » Loop through »

 

sorted(), reversed(), enumerate(), zip()


albums = ('A''B''C''D')
years = (1976198719902003)
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



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Tuple
» Loop through