Last answered:

29 Nov 2023

Posted on:

29 Nov 2023

0

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)
Instructor
Posted on:

29 Nov 2023

0

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

Posted on:

29 Nov 2023

0

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

Submit an answer