Exercise 3 – Sets and Set Operations
Imagine you have two grocery lists:
List A | List B |
Soap | Fish |
Oranges | Pork Loin |
Bananas | Paper Plates |
Oatmeal | Jelly |
Fish | Soap |
Write python scripts that do the following:
Take a screenshot of your python code and the output.
Submit your well-labeled Word document that includes all specified elements.
l1=['Soap','Oranges','Bananas','Oatmeal','Fish']
l2=['Fish','Pork Loin','Paper Plates','Jelly','Soap']
#we can have set operations only on sets so convert lists into
sets
#using set()
s1=set(l1) & set(l2)
#print it converting into list
print(list(s1))
For second question we need to do union operation on this lists
Exercise 3 – Sets and Set Operations Imagine you have two grocery lists: Grocery Lists List...