Interval difference [ ] # @title Interval difference def interval_sub(self, other): "Subtracts from this interval the interval other, returning a possibly empty list of intervals."'"'" ### YOUR SOLUTION HERE Interval. _sub_ = interval_sub [ ] # Tests 10 points. assert Interval(4, 6) assert Interval(0, 10) - - Interval(5, 8) == [Interval(4, 5)] Interval(4, 5) == [Interval(0, 4), Interval(5, 10)]

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
Interval difference
[ ] # @title Interval difference
def interval_sub(self, other):
"Subtracts from this interval the interval other, returning a possibly
empty list of intervals."'"'"
### YOUR SOLUTION HERE
Interval. _sub_ = interval_sub
[ ]
# Tests 10 points.
assert Interval(4, 6)
assert Interval(0, 10)
-
-
Interval(5, 8) == [Interval(4, 5)]
Interval(4, 5) ==
[Interval(0, 4), Interval(5, 10)]
Transcribed Image Text:Interval difference [ ] # @title Interval difference def interval_sub(self, other): "Subtracts from this interval the interval other, returning a possibly empty list of intervals."'"'" ### YOUR SOLUTION HERE Interval. _sub_ = interval_sub [ ] # Tests 10 points. assert Interval(4, 6) assert Interval(0, 10) - - Interval(5, 8) == [Interval(4, 5)] Interval(4, 5) == [Interval(0, 4), Interval(5, 10)]
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning