I'm new to python and I would like to get your advice regarding my function. What I want to do is below.
I have 2 lists A and B.(for example A = [1,2,3,4,5], B = [4,3,2,1]) I want to create a function which finds values in A which does not exist in list B. So in this case 5.
I wrote a function below but it does not work and I could not figure out what is wrong in the code.... Could anyone help me to understand what is the bug?? It seems easy but it is difficult for me. Thank you for your help!!
def finder(arr1,arr2):
arr1 = sorted(arr1)
arr2 = sorted(arr2)
eliminated = []
for x in arr1:
if x not in arr2:
eliminated = eliminated.append(x)
else:
pass
return eliminated