Question: Please CREATE the code and COMMENT THE CODE in python. Thank you 2. Create a class Compute. Your task is to perform operator overloading. Following
2. Create a class Compute. Your task is to perform operator overloading. Following are the operators that would be overloaded. The input for the operators would be same sized lists, same sized tuple or variable-sized dictionary. Following task needs to be completed: For +operator, if the caller is a list, then you need to add the contents of the two lists and return the same sized list. Similarly, you need to add the contents of the two tuples and return the same sized tuple. For a dictionary, you need to concatenate the two dictionaries. If the key is already present, then you need to merge the contents or values of those keys. Example: If input is list: [1,2,3,4] and [3.3,4,5,1.2], then for +operator output would be [4.4,6,8,5.2] [1,2,3,4] and [3.3,4,5,1.2], then for / operator output would be [0.30,8.5,0.6, 3.33] Same applies for tuples. If input is dictionary 11: 'abc',3: 'xyz',5: 'test' and (2: 'test1',3:'test2',4: 'test3', then for operator output would be (1:'abc', 3: 'xyztest2',5:'test', 2:'testl',4:'test3')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
