+ 1

To find factorial

program to find factorial of a number

14th Aug 2017, 8:37 AM
Yash Ranka
4 ответов
+ 14
def factorial(num): if num == 1: return 1 else: return num * factorial(num-1) print(factorial(5))
14th Aug 2017, 8:42 AM
Dev
Dev - avatar
+ 5
@Dayve, you were too fast to answer ...print(factorial(int(input())))
14th Aug 2017, 8:46 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 3
#if you tag string so.... def fact(num): num=int(num) if not num: return 1 else: return num*fact(abs(num-1)) print(fact(5)) print(fact(-5)) print(fact("-5")) print(fact(0)) print(fact(input())) #Currently study on factorial of float number :(
14th Aug 2017, 8:59 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar