Question: 3. The following will be in the script, Lab03_03.py: a) Write a function named hasMidpoint that accepts three integers as parameters and returns True if

 3. The following will be in the script, Lab03_03.py: a) Writea function named hasMidpoint that accepts three integers as parameters and returns

3. The following will be in the script, Lab03_03.py: a) Write a function named hasMidpoint that accepts three integers as parameters and returns True if one of the integers is the midpoint between the other two integers; that is, if one integer is exactly halfway between them. Your function should return False if no such midpoint relationship exists. The integers could be passed in any order; the midpoint could be the 1st, 2nd, or 3rd. You must check all cases. Calls such as the followings should return True: hasMidpoint (4, 6, 8) hasMidpoint (2, 10, 6) hasMidpoint (8, 8, 8) hasMidpoint (10, 25, -5) Calls such as the followings should return false: hasMidpoint (3, 1, 3) hasMidpoint (1, 3, 1) hasMidpoint (21, 9, 58) hasMidpoint (2, 8, 16) b) Write a program to input three integers and call the above function if they satisfy Midpoint relation. The program will input more than one set of data until all are entered as 0. Sample Run: Enter first integer: 4 Enter second integer: 6 Enter third integer: 8 4 6 8 satisfy the Midpoint relation Enter first integer: 1 Enter second integer: 6 Enter third integer: 3 1 6 3 DO NOT satisfy the Midpoint relation Enter first integer: 2 Enter second integer: -2 Enter third integer: 0 2 -2 0 satisfy the Midpoint relation Enter first integer: 0 Enter second integer: 0 Enter third integer: 0

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!