


import numpy as np
from numpy import floataa
from numpy.typing import NDArray






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)->  NDArray[floataa]:




      """simple docstring"""

      snake_case_       ,    snake_case_       =      np.shape(SCREAMING_SNAKE_CASE					)

      snake_case_       =      np.zeros((rows, 1)					,					dtype=SCREAMING_SNAKE_CASE					)
      for row in reversed(range(SCREAMING_SNAKE_CASE					)					):
            snake_case_       =      0
            for col in range(row + 1					,					SCREAMING_SNAKE_CASE					):
                  total += coefficients[row, col] * x[col]

            snake_case_       =      (vector[row] - total) / coefficients[row, row]

      return x






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)->  NDArray[floataa]:




      """simple docstring"""

      snake_case_       ,    snake_case_       =      np.shape(SCREAMING_SNAKE_CASE					)
      if rows != columns:
            return np.array(()					,					dtype=SCREAMING_SNAKE_CASE					)

      # augmented matrix
      snake_case_       =      np.concatenate((coefficients, vector)					,					axis=1					)
      snake_case_       =      augmented_mat.astype('''float64'''					)

      # scale the matrix leaving it triangular
      for row in range(rows - 1					):
            snake_case_       =      augmented_mat[row, row]
            for col in range(row + 1					,					SCREAMING_SNAKE_CASE					):
                  snake_case_       =      augmented_mat[col, row] / pivot
                  augmented_mat[col, :] -= factor * augmented_mat[row, :]

      snake_case_       =      retroactive_resolution(
          augmented_mat[:, 0:columns]					,					augmented_mat[:, columns : columns + 1]					)

      return x


if __name__ == "__main__":
   import doctest

   doctest.testmod()



def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					)->  int:




      """simple docstring"""

      if number != int(SCREAMING_SNAKE_CASE					):
            raise ValueError('''factorial() only accepts integral values'''					)
      if number < 0:
            raise ValueError('''factorial() not defined for negative values'''					)
      snake_case_       =      1
      for i in range(1					,					number + 1					):
            value *= i
      return value






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					)->  int:




      """simple docstring"""

      if not isinstance(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					):
            raise ValueError('''factorial() only accepts integral values'''					)
      if n < 0:
            raise ValueError('''factorial() not defined for negative values'''					)
      return 1 if n == 0 or n == 1 else n * factorial(n - 1					)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   UpperCAmelCase			=    int(input("""Enter a positive integer: """).strip() or 0)
   print(f'''factorial{n} is {factorial(n)}''')