Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This is a code that returns a list that contains only the common elements between two lists without duplicate
- def listsintersct(L1,L2):
- T=[]
- D=[]
- if len(L1)>=len(L2):
- for i in range(len(L2)):
- if L2[i] in L1:
- T+=[L2[i]]
- else:
- for i in range(len(L1)):
- if L1[i] in L2:
- T+=[L1[i]]
- for c in T:
- if c not in D:
- n=0
- for j in range(len(T)):
- if c==T[j]:
- n+=1
- D+=[c]
- return D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement