Python n wybierz r
# PYTHON 3.8
import math
math.comb(n, r)
just-saved-you-a-stackoverflow-visit
# PYTHON 3.8
import math
math.comb(n, r)
>>> from math import comb
>>> comb(20,10)
deck = range(1, 53) #get deck of cards from 1 to 52
comb = list(itertools.combinations(deck, 2)) # make list with unic 2 cards combination
len(comb) #output 1326
# PYTHON <3.8
import operator as op
from functools import reduce
def ncr(n, r):
r = min(r, n-r)
numer = reduce(op.mul, range(n, n-r, -1), 1)
denom = reduce(op.mul, range(1, r+1), 1)
return numer // denom # or / in Python 2