There are two phones, phoneA and phoneB, how to how to find complement in phoneB but not in phoneA, one ex;
phoneA = ["long lasting battery”, ”clear display”, ”great camera”, ”storage space”], [“clear display”, ”long lasting battery”, ”great camera”, ”warp-speed word processing”]
phoneB = ["long lasting battery”, ”clear display”, ”great camera”, ”storage space”], [“clear display”, ”long lasting battery”, ”great camera”, ”warp-speed word processing”, “great sound”]
I write code like this by python:
d = [x for x in phoneB if x not in phoneA]
print(d)
but the code is wrong, anyone has better idea?
You need to add the 2 lists together, then check them:
Or if you have multiple sublists, this will also work: