Question: use the intervals object from this problem. ( Interval Data Type ) Define a data type called Interval in interval.py that represents a closed 1

use the intervals object from this problem. (Interval Data Type) Define a data type called Interval in interval.py that represents a closed 1D interval. The data type must support the following API: interval.Interval Interval(lbound, rbound) constructs an interval i given its lower and upper bounds i.lower() returns the lower bound of i i.upper() i.contains(x) i.intersects(j) str(i) returns the upper bound of i returns True if i contains the value x, and False otherwise returns True if i intersects interval j, and False otherwise returns a string representation of i as [lbound, rbound]. Use this data type for the interval solution. Instance variables- Lower bound of the interval, _lbound (float)- Upper bound of the interval, _rbound (float)__init__(self, lbound, ubound)- Initialize the instance variables to the values of the corresponding parameters lower(self)- Return the value of the instance variable _lbound upper(self)- Return the value of the instance variable _ubound contains(self, x)- Return True if the interval self contains x and False otherwise intersects(self, other)- Return True if the interval self intersects the interval other and False otherwise __str__(self)- Return a string representation of the interval self

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 Programming Questions!