mirror of
https://bitbucket.org/Mattrixwv/pyclasses.git
synced 2025-12-06 18:33:58 -05:00
Added function to get factorial of number
This commit is contained in:
@@ -229,3 +229,10 @@ def gcd(num1: int, num2: int) -> int:
|
||||
else:
|
||||
num2 %= num1
|
||||
return num1 | num2
|
||||
|
||||
#Returns the factorial of the number passed in
|
||||
def factorial(num: int) -> int:
|
||||
fact = 1
|
||||
for cnt in range(1, num + 1):
|
||||
fact *= cnt
|
||||
return fact
|
||||
|
||||
Reference in New Issue
Block a user