Resolved: Calculation of C(6,5)
When I calculate C(6,5) using a formula given in the previous lesson in Python:
math.factorial(6+5-1)/(math.factorial(6-1)*math.factorial(5))
I get 252 and not 6, like in the video, although it does not make much sense. What am I doing wrong?
2 answers ( 1 marked as helpful)
Hey Klim,
Thanks for reaching out!
Consider the formula for combinations:
Following this definition, the code needs to be changed to:
math.factorial(6)/(math.factorial(6-5)*math.factorial(5))
Kind regards,
365 Hristina
I got it, I used the formula for combinations with repetitions, but here we have combinations without repetitions and
math.factorial(6)/(math.factorial(6-5)*math.factorial(5))
equals exactly 6