Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program will be ran through a Python 3 IDE. Write a program that takes as i

ID: 3669493 • Letter: T

Question

This program will be ran through a Python 3 IDE.

Write a program that takes as input two opposite corners of a rectangle: the lower left-hand corner (x1,y1) and the upper right-hand corner (x2,y2). Finally, the user is prompted for the coordinates of a third point (x,y). The program should print Boolean value True or False based on whether the point (x,y) lies within the rectangle. Sample runs are shown below

Enter x1: 1
Enter y1: 3
Enter x2: 10
Enter y2: 6
Enter x: 4
Enter y: 4
True

Enter x1: 1
Enter y1: 3
Enter x2: 10
Enter y2: 6
Enter x: 4
Enter y: 2
False

Explanation / Answer

Can help you with this:

from graphics import *
def main():
win.setCoords(0.0, 0.0, 10.0, 10.0)
message = Text (Point(5, 0.5), "Please click on two points")
message.draw(win)
p1 = win.getMouse()
p1.draw(win)
p2 = win.getMouse()
p2.draw(win)
p3 = win.getMouse()
p3.draw(win)
p4 = win.getMouse()
p4.draw(win)
rectangle = Polygon(p1, p2, p3, p4)
rectangle.setFill("pink")
rectangle.setOutline("red")
rectangle.draw(win)
message.setText("Please click anywhere to exit.")
win.getMouse()
main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote