Question: Please complete this code in python This is the contents of the .py file Please explain the solution. Thanks. You will write a code in

Please complete this code in python

Please complete this code in python This is the contents of the

This is the contents of the .py file

.py file Please explain the solution. Thanks. You will write a code

Please explain the solution. Thanks.

You will write a code in a function named "absoluteDifference" that works with a list of integers. Basically this list has both even and odd integers. Your task is to find the sum of all even integers and odd integers separately, and return the absolute difference between the sum of even and odd numbers. Examples: Input: [1,2,3,4] Output: 2 Explanation: Sum of even numbers in the list is 2+4=6. Sum of odd numbers in the list is 1+3=4. The Absol ute difference between sum of even numbers and odd numbers =64=2 Input: [5,3,8,1] Output: 1 Explanation: 1891=1 Please download this python file - hw02.py. Write your code under the absoluteDifference 0 function only. Please DO NOT change the names of file, class or function. You may, however, rename the parameters (except the self parameter) but NOT reorder them. \#DO NOT CHANGE THE NAMES OF THE FILE, CLASS or METHOD class Homework2: def absolutedifference(self, integers): \# Start your code from here \# For testing your code uncomment below lines. #l= Homework2() \# print ( l.absolutedifference ([1,2,3,4,5] ) \# Comment or delete the above test code before submitting

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!