"""
Lecture 11 - You Try: remove_elem
Returns a new list with all occurrences of e removed.
"""


def remove_elem(L, e):
    """
    - L is a list
    - Returns a NEW list with elements in the same order as L
      but without any elements equal to e.
    """
    new_list = []
    for item in L:
        if item != e:
            new_list.append(item)
    return new_list


# Test calls
L = [1, 2, 2, 2]
print(remove_elem(L, 2))       # [1]

L = [1, 2, 2, 2, 3, 2]
print(remove_elem(L, 2))       # [1, 3]

print(remove_elem([5, 5, 5], 5))   # []
print(remove_elem([1, 2, 3], 4))   # [1, 2, 3]
