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 D interval. The data type must support the following API: interval.Interval Intervallbound rbound constructs an interval i given its lower and upper bounds ilower returns the lower bound of i iupper icontainsx iintersectsj stri 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 floatinitself lbound, ubound Initialize the instance variables to the values of the corresponding parameters lowerself Return the value of the instance variable lbound upperself Return the value of the instance variable ubound containsself x Return True if the interval self contains x and False otherwise intersectsself other Return True if the interval self intersects the interval other and False otherwise strself 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
