May-26-2019, 02:46 PM
Modify your function from the previous question so it takes a list of points rather than a single point and returns boolean True only if all points in the list are in the rectangle.
For example, allIn((0,0), (5,5), [(1,1), (0,0), (5,5)]) should return True
but allIn((0,0), (5,5), [(1,1), (0,0), (5,6)]) should return False
empty list of points allIn((0,0), (5,5), []) should return False
Use the same assumptions as above about the placement of the points and how rectangle is defined. Make sure that your function returns False for empty list of points (no values).
Test your function with at least 3 different sets of data points.
In [ ]:
def allIn(firstCorner=(0,0), secondCorner=(0,0), pointList=[]):
# YOUR CODE HERE
For example, allIn((0,0), (5,5), [(1,1), (0,0), (5,5)]) should return True
but allIn((0,0), (5,5), [(1,1), (0,0), (5,6)]) should return False
empty list of points allIn((0,0), (5,5), []) should return False
Use the same assumptions as above about the placement of the points and how rectangle is defined. Make sure that your function returns False for empty list of points (no values).
Test your function with at least 3 different sets of data points.
In [ ]:
def allIn(firstCorner=(0,0), secondCorner=(0,0), pointList=[]):
# YOUR CODE HERE