Advertisement
here2share

# table_flip.py

Apr 17th, 2019
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. # table_flip.py >>> no gambling, lol
  2.  
  3. table = [  ('Person'    , 'Won' , 'Lost'    ),
  4.            ('Alex'      ,  12   ,  24       ),
  5.            ('Brian'     ,  6    ,  5        ),
  6.            ('Cathy'     ,  17   ,  9        ),
  7.            ('Donna'     ,  3    ,  11       )
  8.         ]        
  9.  
  10. table_flip = zip(*table)
  11.  
  12. for z in table_flip: print z
  13.  
  14. '''
  15. You get:
  16.  
  17. [   ('Person',  'Alex',     'Brian',    'Cathy',    'Donna' )
  18.     ('Won',      12,         6,          17,         3      )
  19.     ('Lost',     24,         5,          9,          11     )
  20. ]
  21. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement