Take two lists, say for example these two:
and write a program that returns a list that contains only the elements that are common between the lists (without duplicates). Make sure your program works on two lists of different sizes.
In other words, “things you can do with lists.”
One of the interesting things you can do with lists in Python is figure out whether something is inside the list or not. For example:
You can of course use this in loops, conditionals, and any other programming constructs.
Forgot how to submit exercises?comments powered by Disqus