Skip to content

Instantly share code, notes, and snippets.

View keshavseksaria's full-sized avatar

Keshav Seksaria keshavseksaria

View GitHub Profile
@letsintegreat
letsintegreat / factorial.py
Last active December 6, 2018 14:18
Code written under an event called Google Code-in.
# Method to calculate factorial of the number passed as a parameter using recursion.
def fact(num):
if num <= 1:
return 1
return num * fact(num - 1) * 1.00
try:
print('Enter a number: ') # Message to display on screen
# I'm casting the entered string into float because if the entered number is 5.0 then it raises a ValueError,