Write a function named add_unique(initial_list, new_elements_list)
that accepts two arguments:
initial_list
– a list with any number of elements.
new_elements_list
– a list with new elements that should be added to initial_list
.
However, any element from new_elements_list
that already occurs more than once in initial_list
should NOT be added. Also, two identical elements should appear in the list at most twice.
For example, for the following input:
initial_list = [1, 5, 5, 3]
new_elements_list = [4, 5, 6, 3, 3]
The function should return:
initial_list = [1, 5, 5, 3, 4, 6, 3]
You can use the template code to test your solution.