I want to find $ _4C_2 $ in python. It seems easy to do with scipy.special.comb, a library called scipy.
If you write as follows
import scipy
print(scipy.special.comb(4, 2))
error
AttributeError: module 'scipy' has no attribute 'special'
It is OK to write as follows
from scipy.special import comb
print(comb(4, 2))
Execution result
6.0
The following is also possible
from scipy import special
print(special.comb(4, 2))
import scipy
not
from scipy.special import comb
or
from scipy import special
Recommended Posts