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: +, -, *, /, **,%, //
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
Step by step
Solved in 4 steps with 2 images