def factorialFinderLoops(n):
    """Returns the factorial of the positive integer n using
       loops."""
    if not isinstance(n, int):
        raise TypeError('n should be a positive integer.')
        return None
    if n < 0:
        raise ValueError('n should be a positive integer.')
        return None
    result = 1
    for i in range(2, n + 1):
        result *= i
    return result