Question
(a) Write the following functions and their docstrings: between(num1, num2, num3) takes 3 integer arguments and returns True if num1 is between num2 and num3.
(a) Write the following functions and their docstrings: between(num1, num2, num3) takes 3 integer arguments and returns True if num1 is between num2 and num3. It is not between them if it is equal to either of the other two. For example, given the inputs 2,7 and 0, the value returned should be True. Given the inputs 3,-1 and 3, False should be returned. Note that there is no restriction that num2 must be less than num3. majority3(num_list) returns True if more than half of the integers in the num_list are divisble by three, otherwise it returns False. The list can be of any size. Recall that zero is divisble by 3 with no remainder. For example, the function should return False for the list [1,2,3,6] (as only two of the four numbers are divisble by three) and True for the list [0,1,-3] as (2 of the 3 numbers are divisible by three). (b) Generate at least six test cases for each function you wrote in part (a). You may use white-box and/or black-box test case generation. Carefully and strategically select your white-box test cases. As you choose your cases, try to think about all the dierent paths of execution through your code and identify cases that cause the execution of each of those paths at least once. (c) Implement a test driver which thoroughly tests both functions using the tests identied in part (b). Implement the test driver using the techniques seen in the textbook (Chapter 15) and as demonstrated in class (Chapter 15 Exercise 3).
Step 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