I want to find the intersection of two lists in python. I have something similar to this:
>>> q = ['apple', 'peach', 'pear', 'watermelon', 'strawberry']
>>> w = ['pineapple', 'peach', 'watermelon', 'kiwi']
and I want to find something similar to this:
t = ['peach', 'watermelon']
I know its simple, question, but I'm new to python - does anyone have any suggestions?
source
share