Question
A MySetOperations is a collection of functions, on which the following set operations are defined: myIsEmpty(A): Returns T if the set A is empty (A
A MySetOperations is a collection of functions, on which the following set operations are defined: myIsEmpty(A): Returns T if the set A is empty (A = ), F otherwise. myIntersection(A,B): Returns the intersection of the set A and set B (A B). myUnion(A,B): Returns the union of the set A and set B (A B). Write a collection of MySetOperations in Python. Note: For this problem you CAN USE ONLY the standard flow Pythons instructions and the set build-in operations: len, in, not in, and add.
This is what i inputted, but i keep getting a syntax error. Can anyone tell me what i did wrong?
Exercise #4: (15 pts = 3 + 5 + 7) class MySetoperations: def myIsEmpty (self,A): if len (A): return false return True def myIntersection (self,A,B): return A&B def myUnion (self,A,B) : return A | B A MySetOperations is a collection of functions, on which the following set operations are defined: myIsEmpty(A): Returns T if the set A is empty (A = ), F otherwise. myIntersection(A,B): Returns the intersection of the set A and set B ( A B ). myUnion(A,B): Returns the union of the set A and set B (AUB). Write a collection of My SetOperations in Python. ob=MySetOperations (). A = {1, 2, 3, 4, 5} B = {4, 5, 6, 7, 8} print ob.myIsEmpty (A) print ob.myIntersection (A,B) print ob.myUnion (A,B) Note: For this problem you CAN USE ONLY the standard flow Python's instructions and the set build-in operations: len, in, not in, and addStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started