Question #3: Is a data point within a rectangle? (4 points) Write a function isIn() which returns True ifa point is within a rectangle specined by two sets of coordinates and False if the point is outside the rectangle. The function should accept three parameters: the first parameter is a set of coordinates which defines one of the corners of the rectangle, the second parameter is also a set of coordinates that defines the second comer, the third set of coordinates defines a single point which is being tested. For example .isIn((1,2), (3,4), (1.5, 3.2)) should return True .isIn((4,3.5), (2,1), (3, 2)) should return True .isIn((-1,0), (5,5), (6,e)) should return False isin((4,1), (2,4), (2.5,4.5)) should return False Test your function with at least 2 different sets of data points in addition to the examples above. 1. If the point being tested is on the side of the rectangle, consider it to be within the rectangle. For example, if the rectangle is defined as (1,2), (3,4) and the point is (2,2), the function should retum True 2. In this assignment, we assume that the edges of the rectangle are parallel to coordinate axes. 3. We also assume that the first parameter does not always represent the left comer of the rectangle and the second parameter is not always the right comer. The function should work correctly either way. Please note the second test condition above where the first parameter, (4,3.5) , represents the top-right comer and the second parameter, (2,1) represents left -bottom corner In [: def isIn(firstCorner-(e,0), secondCorner-(0,8), point-(,0)): # YOUR CODE HERE In : In : Question #4: Are all points within a rectangle? (4 points) Modity your function from the previous question so it takes a list of points rather than a single point and returns True only ir all points in the list are in the rectangle For example . allIn( (,), (5,5), [(1,1), (,e), (5,5)]) should return True but allIn( (e,e), (5,5), [(1,1), (e,e), (5,6)]) should return False Use the same assumption as above about the placement of the points and how rectangle is defined Test your function with at least 3 difterent sets of data points In : def allIn(firstCorner-(8,e), secondcorner-(e,), pointList-): # YOUR CODE HERE In : In : In : In :
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more