Guest User

Untitled

a guest
Jan 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. """
  2. Creates 2D matrix
  3. """
  4.  
  5.  
  6. def matrix(rows, cols, start=0):
  7. return [[c + start + r * cols for c in range(cols)] for r in range(rows)]
  8.  
  9.  
  10. assert matrix(2, 3, 1) == [[1, 2, 3], [4, 5, 6]]
Add Comment
Please, Sign In to add comment