kxcoze

marina_makoha_lab??_2

May 11th, 2021 (edited)
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from itertools import combinations
  2.  
  3. import numpy as np
  4.  
  5.  
  6. def C(n, k):
  7.     return len(list(combinations(range(1, n), k)))
  8.  
  9.  
  10. n = 10
  11. matrix = []
  12. for i in range(1, n+1):
  13.     line = []
  14.     for j in range(1, n+1):
  15.         if i >= j:
  16.             result = C(i, j)
  17.         else:
  18.             result = C(j, i)
  19.         line.append(result)
  20.     matrix.append(line.copy())
  21.  
  22. print(np.array(matrix))
  23.  
Add Comment
Please, Sign In to add comment