Question: 2. Combinations: Suppose, you have n objects and you need to choose k objects from those. Obviously, n,k should be non-negative and k must not

2. Combinations: Suppose, you have n objects and you need to choose k objects from those. Obviously, n,k should be non-negative and k must not be larger than n. There are multiple ways you can choose and you need to calculate the total number of ways. This is known as a combination, and it can be calculated using the formula: (nk)=k!(nk)!n!. Here, n! means factorial of n, i.e. n!=123..n. By definition, 0!=1. In a file L5q2.py: write a function named my_factorial() which will compute and return n !; a function named my_combination () to calculate and return the number of combinations given the values of n and k using my_factorial() to aid in the calculation; and a program which will prompt the user to input values of n and k, call my_combination(), and display the number of combinations. Your input should be validated to ensure that 0kn
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
