{"id":47414,"date":"2022-03-31T17:52:16","date_gmt":"2022-03-31T17:52:16","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/question-3-is-a-data-point-within-a-rectangle-4-points-write-a\/"},"modified":"2022-03-31T17:52:16","modified_gmt":"2022-03-31T17:52:16","slug":"question-3-is-a-data-point-within-a-rectangle-4-points-write-a","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/question-3-is-a-data-point-within-a-rectangle-4-points-write-a\/","title":{"rendered":"Question #3: is a data point within a rectangle? (4 points) write a"},"content":{"rendered":"<div>\n<p>\u00a0\u00a0Question #3: Is a data point \u00a0within a rectangle? (4 points) Write a function isIn() which returns \u00a0True ifa point is within a rectangle specined by two sets of coordinates \u00a0and False if the point is outside the rectangle. The function should \u00a0accept three parameters: the first parameter is a set of coordinates \u00a0which defines one of the corners of the rectangle, the second parameter \u00a0is also a set of coordinates that defines the second comer, the third \u00a0set of coordinates defines a single point which is being tested. For \u00a0example .isIn((1,2), (3,4), (1.5, 3.2)) should return True \u00a0.isIn((4,3.5), (2,1), (3, 2)) should return True .isIn((-1,0), (5,5), \u00a0(6,e)) should return False isin((4,1), (2,4), (2.5,4.5)) should return \u00a0False Test your function with at least 2 different sets of data points \u00a0in addition to the examples above. 1. If the point being tested is on \u00a0the side of the rectangle, consider it to be within the rectangle. For \u00a0example, if the rectangle is defined as (1,2), (3,4) and the point is \u00a0(2,2), the function should retum True 2. In this assignment, we assume \u00a0that the edges of the rectangle are parallel to coordinate axes. 3. We \u00a0also assume that the first parameter does not always represent the left \u00a0comer of the rectangle and the second parameter is not always the right \u00a0comer. The function should work correctly either way. Please note the \u00a0second test condition above where the first parameter, (4,3.5) , \u00a0represents the top-right comer and the second parameter, (2,1) \u00a0represents left -bottom corner In [: def isIn(firstCorner-(e,0), \u00a0secondCorner-(0,8), point-(,0)): # YOUR CODE HERE In []: In []: Question \u00a0#4: Are all points within a rectangle? (4 points) Modity your function \u00a0from the previous question so it takes a list of points rather than a \u00a0single point and returns True only ir all points in the list are in the \u00a0rectangle For example . allIn( (,), (5,5), [(1,1), (,e), (5,5)]) should \u00a0return True but allIn( (e,e), (5,5), [(1,1), (e,e), (5,6)]) should \u00a0return False Use the same assumption as above about the placement of the \u00a0points and how rectangle is defined Test your function with at least 3 \u00a0difterent sets of data points In []: def allIn(firstCorner-(8,e), \u00a0secondcorner-(e,), pointList-[]): # YOUR CODE HERE In []: In []: In []: \u00a0In : \u00a0\u00a0<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"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 :\" src=\"https:\/\/media.cheggcdn.com\/media%2F621%2F62143e3d-b636-4960-ab90-338107e24078%2Fphpepr8Ez.png\" width=\"680\" height=\"1024\"\/>\u00a0<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0Question #3: Is a data point \u00a0within a rectangle? (4 points) Write a function isIn() which returns \u00a0True ifa point is within a rectangle specined by two sets of coordinates \u00a0and False if the point is outside the rectangle. The function should \u00a0accept three parameters: the first parameter is a set of coordinates \u00a0which defines [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-47414","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=47414"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47414\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=47414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=47414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=47414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}