I'm not sure why I get an error saying index out of range when I test this function. Can anyone please help me fix this?
def intersect_lists(L1, L2): '''(list, list) -> list Return L1 with items not in L2 removed. >>> intersect_lists([1, 2, 3, 4, 5, 6], [4, 2, 6]) [2,4,6] ''' new_list = [] for item in range(len(L1)): if L1[item] == L2[item]: new_list.append(L1[item]) return new_list