This is the objectif: Write a function to get 2 list L1 and L2 and build and return a third list L3 made of the elements that are in both list L1 and list L2 only i.e exclude any value that is only in L1 or only L2.
The problem: I am stuck in the loop (that will only take the values that both alist and blist share).
my code:
alist=input("Enter words separated by space: " ).split(" ")
blist=input("Enter words separated by space: " ).split(" ")
clist=[" "]
for i in alist,blist:
if alist(i)==blist(i):
clist=alist(i)+blist(i)
return clist