Advertisement
stiansjogren

Untitled

Nov 22nd, 2016
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. def differentValuesInMultiplicationTable2(n, m):
  2. Matrix = [[0 for x in range(m)] for y in range(n)]
  3. for row in range(0,n):
  4. for col in range(0,m):
  5. Matrix[row][col]= (row+1)*(col+1)
  6.  
  7. return find_diff(list(Matrix))
  8.  
  9. def find_diff(matr):
  10. nested = matr
  11. flat = [x for sublist in nested for x in sublist]
  12. return len(list(set(flat)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement