Question: python Problem 5 A closed interval of the real number line is defined by its lower and upper end points. Write a function interval_intersection(lA, uA,
python
Problem 5
A closed interval of the real number line is defined by its lower and upper end points. Write a function interval_intersection(lA, uA, lB, uB) that returns the length of the intersection of two intervals A and B. Arguments lA and uA are the lower and upper end points of interval A, and lB and uB are the lower and upper end points of interval B. If the intervals do not intersect, the function should return 0.
For example, interval_intersection(0, 3, 1, 5) should return 2, because he intersection of the two intervals [0,3] and [1,5] is [1,3], which has a length of 3 - 1 = 2.
You can assume that the functions arguments are numbers, but not that they are integers, or positive.
Your function must return a number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
