Question: Exercise #4: (11 pts = 5 pts + 6 pts) Given two sets, A and B, write the following functions in Python. (a) myDisjoint(A,B) that

 Exercise #4: (11 pts = 5 pts + 6 pts) Given

Exercise #4: (11 pts = 5 pts + 6 pts) Given two sets, A and B, write the following functions in Python. (a) myDisjoint(A,B) that returns True if the intersection between set A and set B is empty, False otherwise (b) myDifference(A,B) to compute AB To write these functions you must use only the flow and loop Python's instructions, the set build-in operations: in, not in, add, and the following auxiliary functions. def my Is Empty(A): # Returns T if the set A is empty, F otherwise if len(A) == 0: return True else: return false def my Intersection (A,B): # Returns the intersection between set A and set B I - set() if my IsEmpty(A) or my Is Empty(): return I for element in A: if element in B: I.add(element) return

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!