Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- M,N=10,10
- matrix=[[random.randrange(2) for y in range(M)] for x in range(N)]
- In [35]: matrix
- Out[35]: [[0, 0, 1, 0], [0, 0, 1, 0], [1, 1, 0, 1], [0, 1, 0, 0]]
- In [36]: from itertools import combinations
- In [37]: [(i,j) for i,j in combinations(range(len(matrix)), 2) if matrix[i] == matrix[j]]
- Out[37]: [(0, 1)]
Add Comment
Please, Sign In to add comment