“python n elige r” Código de respuesta

python n elige r

# PYTHON 3.8
import math
math.comb(n, r)
just-saved-you-a-stackoverflow-visit

Python Elija la función

>>> from math import comb
>>> comb(20,10)
Impossible Ibis

Python Elija la función

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
MrStonkus

python n elige r

# 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
just-saved-you-a-stackoverflow-visit

Respuestas similares a “python n elige r”

Preguntas similares a “python n elige r”

Más respuestas relacionadas con “python n elige r” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código