Question: Write a Python recursive function called combination ( n , k ) to compute the number of k - combinations ( without repetition ) from

Write a Python recursive function called combination(n, k) to compute the number of k-combinations (without repetition) from a given set S of n elements, denoted as C(n,k). You can use the following recursive formula
C(n, k)= C(n 1, k 1)+ C(n 1, k)
Prompt the user to input the integer value of n and k, separated by a space, on a single line and print out the value of C(n, k)(print 0 if C(n, k) does not exist). You can assume that user input will only be integers (1<= n, k <=30).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!