def main():
def numSys(x):
if x == 1:
print ("BASELINE (1) REACHED!")
return 1
else:
return x * numSys(x-1)
def userSystem():
a = input("Initial Number: ")
try:
a = int(a)
except:
print ("ERROR! Please type a valid number!")
userSystem()
factorialSum = numSys(a)
print (factorialSum)
#INITIATE FUNCTIONS
userSystem()
main()
When inputting a number on the first prompt, it would be successful, but when i test the (try/except) function by putting a letter first, then putting a number, it would be successful but with a error in the end
Console Log
New contributor
Raphael Irvin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.