Advertisement
sdamashek

Untitled

Mar 27th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. # Ruby
  2. a = []
  3. 3.times{|x| 3.times{|y| a << [x,y] if x != y }}
  4.  
  5. # Python
  6. a = []
  7. for x in range(3):
  8. for y in range(3):
  9. if x != y:
  10. a += [(x,y)]
  11.  
  12. Both produce [[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement