def categorize_nps(x):
    """ 
    Takes a NPS rating and outputs whether it is a "promoter", 
    "passive", "detractor", or "invalid" rating. "invalid" is
    returned when the rating is not between 0-10.

    Args:
        x: The NPS rating

    Returns:
        String: the NPS category or "invalid".
    """
    # Write the rest of the function to match the docstring
    if(x >= 0 and x <= 6):
        return "detractor"
    elif(x == 7 or x == 8):
        return "passive"
    elif(x == 9 or x == 10):
        return "promoter"
    else:
        return "invalid"