nCk python combinations code example
Example 1: python nCr n choose r function
# Basic syntax:
from math import comb
comb(n, r) # calculates "n choose r" aka nCr aka binomial coefficients
Example 2: python choose function
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