def all_but_last(seq):
    """ Returns a new sequence containing all but the last element of the input sequence.
    If the input sequence is empty, a new empty sequence of the same type should be returned.

    Example:
    >>> all_but_last("abcde")
    "abcd"
    """
    newSeq = seq * 0
    for i in range(len(seq) - 1):
        newSeq += seq[i]
    return newSeq