def strip_spaces(fields):
    """
    Strip spaces and newline characters from a list of strings.

    Inputs
    ------
    fields : list of strings

    Returns
    -------
    list : modified input list where the characters ' \n' have been stripped

    Examples
    --------
    strip_spaces(['hi ', 'zeven 1', 'yo\n'])
    """

    # id(fields[:]) ≠ id(fields). fields[:] creates a new copy to allow
    # me to edit fields inside the loop (Remember Python passes by reference)
    # strip out spaces
    for element in fields[:]:
        # pop out the first element
        fields.pop(0)
        # append the first element back after stripping
        fields.append(element.strip(' \n'))  # \n only needed for last element
    return fields