Factorial of a Number (One Liner Code)

PHOTO EMBED

Wed Aug 10 2022 08:40:19 GMT+0000 (UTC)

Saved by @redpsych

num1 = 5
num2 = 0
num3 = 12

factorial = lambda num : 1 if num <= 1 else num*factorial(num-1)

print("Factorial of", num1, ":", factorial(num1))
print("Factorial of", num2, ":", factorial(num2))
print("Factorial of", num3, ":", factorial(num3))
content_copyCOPY