Hello dear SO members and staffs. I have been working on a project where I took the coordinates of the already drawn rectangle with the center of (0,0) coordinates. What I want to do is ask the user to put his x and y coordinates, after which it will tell you that whether if your coordinates is within the area of that or not. I have reached some of my goals, except the one that I need to ask the if statement for both of the x and y at the same time as if I will write only X statement it will display for only checking the X and not Y. So, I need your help in how to check both of them before displaying? (The center of the rectangle is at the (0,0) with the total length of 5 and the width of 10.)
y1 = -2.5
y2 = 2.5
x1 = -5
x2 = 5
inputX = eval(input("Please put in the X coordinate: "))
inputY = eval(input("Please put in the Y coordinate: "))
if x1<inputX<x2, y1<inputY<y2:
print("Your coordinates are in the range of the rectangle!")
else:
print("Sorry, your coordinates are not in the range of the rectangle!")