def factorial(num): ''' (int) -> int Computes the factorial of the number provided. num is the integer to get the factorial of. It must be a positive integer. Raises TypeError if num is not an int. Raises ValueError if num is not positive. Returns an int representing the factorial of the number passed in. ''' if not isinstance(num, int): raise TypeError('Only integers are accepted for factorial.') if num < 0: raise ValueError('Number must be a positive integer.', num) #computing factorial product = 1 for i in range(1, num+1): product *= i return product def toint_factorial_arg(value): value = int(value) return factorial(value) inp = input('Please enter a positive integer: ') fact = toint_factorial_arg(inp) print('The factorial is:', fact)