"""Python program to find the factorial of a number provided by the user."""

# change the value for a different result
NUM = 10

# uncomment to take input from the user
# num = int(input("Enter a number: "))

FACTORIAL = 1

# check if the number is negative, positive or zero
if NUM < 0:
    print("Sorry, factorial does not exist for negative numbers")
elif NUM == 0:
    print("The factorial of 0 is 1")
else:
    for i in range(1, NUM + 1):
        FACTORIAL = FACTORIAL * i
    print("The factorial of", NUM, "is", FACTORIAL)

@@ -1,367 +1,367 @@
-%22%22%22Python program to find the factorial of a number provided by the user.%22%22%22%0A%0A# change the value for a different result%0ANUM = 10%0A%0A# uncomment to take input from the user%0A# num = int(input(%22Enter a number: %22))%0A%0AFACTORIAL = 1%0A%0A# check if the number is negative, positive or zero%0Aif NUM %3C 0:%0A    print(%22Sorry, factorial does not exist for negative numbers%22)%0Aelif NUM
+def factorial(input_number: int) -%3E int:%0A    %22%22%22%0A        Non-recursive algorithm of finding factorial of the%0A        input number.%0A        %3E%3E%3E factorial(1)%0A        1%0A        %3E%3E%3E factorial(6)%0A        720%0A        %3E%3E%3E factorial(0)%0A        1%0A    %22%22%22%0A%0A    if input_number %3C 0:%0A        raise ValueError('Input input_number should be non-negative')%0A    elif input_number
  == 
@@ -371,161 +371,140 @@
     
+   
-print(%22The factorial of 0 is 1%22)%0Aelse:%0A    for i in range(1, NUM + 1):%0A        FACTORIAL = FACTORIAL * i%0A    print(%22The factorial of%22, NUM, %22is%22, FACTORIAL)
+ return 1%0A    else:%0A        result = 1%0A        for i in range(input_number):%0A            result = result * (i + 1)%0A    return result
 %0A

rewrite the algorithm from scratch (#1351)