def factorial(n):
    """
    Returns the value of factorial of non-negative integer n

    Parameters
    ----------
    n : int
        denotes non-negative integer
    return : int
        returns integer value denoting factorial of n

    """
    if(n<0):
        raise ValueError(
            "n must be non-negative integer"
        )

    if(n == 0 or n == 1):
        return 1
    
    return n*factorial(n-1)