21 Aug uestion #3: Is a data point within a rectangle?
uestion #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 :
![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 :](https://media.cheggcdn.com/media%2F621%2F62143e3d-b636-4960-ab90-338107e24078%2Fphpepr8Ez.png)
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
