human
Can you show me a Python function to do in the list except the last one.
assistant
Here is a Python function to list the last items in the list except the last

import itertools

def for_in_list_except_last(list, item):
    """for in list except the last"""
    for i in range(len(list) - 1):
        if list[i] == item:
            return i
    return -1

# Enter the list
list = ['a', 'b', 'c', 'd', 'e']

# Enter the item
item = 'a'

# Calling the function
print((for_in_list_except_last(list, item)))

#Example Output
# 0

#Remember to inspect code for bugs.