Skip to content

Commit dfc3126

Browse files
committed
added test_skill in bab 9
1 parent a3e4421 commit dfc3126

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Find Factorial Value
2+
3+
def factorial(x):
4+
if (x == 0):
5+
return 1
6+
else:
7+
return (x * factorial(x - 1))
8+
9+
10+
def Combination(n, r):
11+
if r < 0:
12+
return 'rasio cannot be negative'
13+
else:
14+
return factorial(n) // (factorial(r) * factorial(n - r))
15+
16+
17+
if __name__ == '__main__':
18+
n = int(input("n= "))
19+
r = int(input("r= "))
20+
print(Combination(n, r))

0 commit comments

Comments
 (0)