This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |