def factorial(n):
    """
    What comes in:  The sole argument is a non-negative integer n.
    What goes out:  Returns n!, that is, n x (n-1) x (n-2) x ... x 1.
    Side effects:   None.
    Examples:
        factorial(5) returns 5 x 4 x 3 x 2 x 1, that is, 120.
        factorial(0) returns 1 (by definition).
    """
    # -------------------------------------------------------------------------
    # DONE: 5. Implement and test this function.
    #   Note that you should write its TEST function first (above).
    #
    # IMPORTANT:  Your solution MUST
    #   use an explicit    for ... in range(...):     statement.
    # -------------------------------------------------------------------------
    answer_from_my_code = 1
    for k in range(n):
        answer_from_my_code = answer_from_my_code*(n-k)
    return answer_from_my_code