rite 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: +, -, *, /, **,%, //

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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
>>>
>>> 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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY