Guest User

Untitled

a guest
May 31st, 2010
292
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = range(1,10)
  2.  
  3. #1 variant
  4. for i in a:
  5.     rev = (-1,1)[i % 2]
  6.     print " ".join(map(str, a[:i][::rev]))
  7.  
  8. #2 variant    
  9. d = [[str(j) for j in a[:i][::(-1,1)[i % 2]]] for i in a]
  10. print "\n".join([" ".join(j) for j in d])
RAW Paste Data