Write a function in_out (xs, ys, side) which takes three numbers as input, where the side is non-negative. Here xs and ys represent the x and y coordinates of the lower left corner of a square; and...


Write a function in_out (xs, ys, side) which takes three numbers as input, where the side is non-negative. Here xs and ys represent the x and y coordinates of the lower left corner of a square; and side represents the length of the side of the square. (Note that xs, ys and sides completely define a square and its position in the plane). Your function must first prompt the user to enter two numbers that represent the x and y coordinates of a point request. Your function should display True if the given query point is inside of the given square, otherwise it should display False. A point on the limit of a square is considered as being inside the square.



No loops, no ifs, no lists


To avoid confusion, unless otherwise noted in the questions, here is what you


can use in these exercises:


- comparison operators: <,><=, ==",!" =,="">,> =


- Boolean operators: and, or, not


- arithmetic operators: +, -, *, /, **,%, //


- the following Python built-in functions: print, input, round, len, int, float, str


- string operators: +, *


- any function of the mathematical module (recall import math, dir (math), then


you can call the help on any function of the math module for example


help (math.sqrt))


- anything from the Turtle module


- keywords: def, return


>>> # testing Question 3<br>>>><br>>>> in_out(0,0,2.5)<br>Enter a number for the x coordinate of a query point: 0<br>Enter a number for the y coordinate of a query point: 1.2<br>True<br>>>> in_out(2.5,1,1)<br>Enter a number for the x coordinate of a query point: -1<br>Enter a number for the y coordinate of a query point: 1.5<br>False<br>>>> in_out(-2.5,1,2.1)<br>Enter a number for the x coordinate of a query point: -1<br>Enter a number for the y coordinate of a query point: 1.5<br>True<br>

Extracted text: >>> # testing Question 3 >>> >>> in_out(0,0,2.5) Enter a number for the x coordinate of a query point: 0 Enter a number for the y coordinate of a query point: 1.2 True >>> in_out(2.5,1,1) Enter a number for the x coordinate of a query point: -1 Enter a number for the y coordinate of a query point: 1.5 False >>> in_out(-2.5,1,2.1) Enter a number for the x coordinate of a query point: -1 Enter a number for the y coordinate of a query point: 1.5 True
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here