def last(iter: (list or range)):
    """Returns the last element from the list or range
    """
    if type(iter) == list:
        return iter[len(iter) - 1]
    elif type(iter) == range:
        return iter.stop - (iter.stop - 1 - iter.start) % iter.step - 1
    else:
        raise ValueError('iter must be of type list or range')
