From 3f822365fc68d2ad1852ca36984b48521dbb40f4 Mon Sep 17 00:00:00 2001 From: Kishan Kumar Rai <70385488+kishanrajput23@users.noreply.github.com> Date: Tue, 9 Feb 2021 20:15:10 +0530 Subject: [PATCH] assignment 2 --- Week4/Week 4 Programming Assignment 2.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Week4/Week 4 Programming Assignment 2.py diff --git a/Week4/Week 4 Programming Assignment 2.py b/Week4/Week 4 Programming Assignment 2.py new file mode 100644 index 0000000..c5e640a --- /dev/null +++ b/Week4/Week 4 Programming Assignment 2.py @@ -0,0 +1,23 @@ +def fact(num): + + product=1 + + while(num>1): + + product*=num + + num-=1 + + return product + +m=int(input()) #m=men + +n=int(input()) #n=women + +if m+n>20 or m<=n: + + print('invalid',end="") + +else: + + print(fact(m)*fact(n)*fact(m+1)//(fact(n)*fact(m+1-n)),end="") \ No newline at end of file