Question: Problem 1 A and B are two sets, represented as lists. Apply list comprehension to compute and print the following sets (also represent them as

 Problem 1 A and B are two sets, represented as lists.

Problem 1 A and B are two sets, represented as lists. Apply list comprehension to compute and print the following sets (also represent them as lists). Note: Though Python has a set datatype, please do not use it for this problem. Work only in lists. Write a function to find the intersection of the input lists. This is every element in both set_a and set_b. In [ ]: def intersection(set_a, set_b): ### YOUR CODE HERE intersection([1,2,3,4], [3,4,5,6]) #[3, 4] Write a function to find the union of the input lists. This is every element in either set_a or set_b. There are no duplicates. In [ ]: def union(set_a, set_b): ### YOUR CODE HERE union([1,2,3,4], [3,4,5,6]) #[1, 2, 3, 4, 5, 6] Write a function to find the difference of the input lists. This is every element in set_a with the union of the sets removed. In [ ]: def difference (set_a, set_b): ### YOUR CODE HERE difference ([1,2,3,4], [3,4,5,6]) #[1, 2]

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!