Question: Write a program that defines two lists as variables and computes the intersection of these two lists ( i . e . , a list

Write a program that defines two lists as variables and computes the intersection of these two lists (i.e., a list of elements that are common to both lists).
Run the following test cases and make sure your results are correct:
lst1=[1,3,5], lst2=[5,3,1] The output should be [1,3,5]
lst1=[1,3,6,9], lst2=[10,14,3,72,9] The output should be [3,9]
lst1=[2,3], lst2=[3,3,3,2,10] The output should be [3,2]
lst1=[2,4,6], lst2=[1,3,5] The output should be []
N.B.: The order of your outputs does not matter [3,2] is the same as [2,3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!