Answer To: # DO NOT CHANGE THE FOLLOWING CODE: import list_lib as ll # END SECTION OF CODE YOU'RE NOT CHANGING...
Neha answered on May 01 2021
56218/__pycache__/list_lib.cpython-38.pyc
56218/intersect.py
# DO NOT CHANGE THE FOLLOWING CODE:
import list_lib as ll
# END SECTION OF CODE YOU'RE NOT CHANGING
# Define a function called diff that takes in two input arrays, and
# returns a new array that consists of all the elements of the first
# array that are not in the second array.
#
# intersect([1,2,42,5], [7,1,43,2,76,84]) = [42,5]
# intersect([1,2,42,5], [42,43,76,5,1]) = [2]
def diff(li1, li2):
return (list(set(li1) - set(li2)))
lst1 = [4, 9, 1, 17, 11, 26, 28, 54, 69]
lst2 = [9, 9, 74, 21, 45, 11, 63, 28, 26]
print(diff([1,2,42,5], [7,1,43,2,76,84]))
print(diff([1,2,42,5], [42,43,76,5,1]))
56218/list_lib.py
import copy
import sys
import random
def cons(x, l):
new_l = copy.copy(l)
new_l.insert(0,x)
return new_l
def head (l):
if l == []:
print("Cannot...