Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Python 3.5) Purpose: To practice testing for functions you write yourself. For

ID: 3801789 • Letter: #

Question

(Python 3.5) Purpose: To practice testing for functions you write yourself. For each of the following, implement the stated function, and test it:

a) The function closest_to_zero3(num1, num2, num3) returns value closest to zero from its 3 inputs. For example, given the numbers 2,7,0, the number closes to 0 is 0. For another example, number closest to 0 when comparing 3,-1,5 is -1. Hint: the abs() function may be useful for this question.

b) The function more_odds_than_even(num_list) returns True if the sum of all integers from num_list in odd numbered indices is greater than the sum of all integers of even numbered indices. For example, the function should return False for the list [1,2,3] (Index positions 0 and 2 give the sum of 4 (1+3), and index position 1 gives the sum of 2) and True for the list [1,2] (There is only one even index position (0), and one odd index position(1), and 2 > 1).

Solution Code:

I was wondering if someone can please help me develop test cases for this code. I am very stuck at this point as I am new to programming. I would require three White Box and Black Box test-cases. Thank You

Explanation / Answer

Test Case1:
closest_to_zero3(0,4,-1)
Answer should be : 0

Test Case2:
mylist = [1,2,3];
more_odds_than_even( mylist );
Answer should be : False

Test Case3:
closest_to_zero3(-2,9,3)
Answer should be : -2

Test Case4:
mylist = [1,2,3,4,5,6];
more_odds_than_even( mylist );
Answer should be : True

Test Case5:
closest_to_zero3(-99,101,110)
Answer should be : -99

Test Case6:
mylist = [-10,2,3,4,5,-6];
more_odds_than_even( mylist );
Answer should be : False