def factorial(n):
    """
    This function calculates the factorial of a given number n.

    parameters
    ----------
    n: an integer you want to calculate the factorial af

    returns
    -------
    The factorial of the number you just provided

    examples
    --------
    >>> factorial(4)
    24
    >>> factorial(5)
    120
    >>> factorial(6)
    720
    """
    n = int(n)
    fact = 1
    while n != 0:
        fact *= n
        n -= 1
    return fact
