Question: PROGRAM MUST BEINPYTHON Ask the user to enter the (x, y) coordinates for two points. Store them in variables called x1, y1, x2, y2 (note


PROGRAM MUST BEINPYTHON Ask the user to enter the (x, y) coordinates for two points. Store them in variables called x1, y1, x2, y2 (note that in general we should avoid naming variables using single letter variable names, but in this case it makes sense since we are representing coordinates). Ask for them one at a time (that is "Please enter the x coordinate of the first point" etc). Output both the distance between the two points and the coordinates of the point that represents the midpoint between the two points. Recall that the distance between two points is calculated as the square root of (x2-x1)2 + (y2-y1)2. You can use the sqrt function that is built into Python to find the square root. Use the sqrt function like this: math.sqrt(16) (try this in the Python shell). In place of the number 16, try using a variable. To use the math module, you will need to add the following line to your code: import math To get the midpoint, you can use the formula M = ( (x1 + x2)/2, (y1 + y2)/2)). Restrict your outputs to 3 decimal places. Your program should be "user friendly" -- that is, your user should be able to understand what your program does, what is the expected input from them and what the outputted results represent. Leave space between your questions and the user's input. Your program should not just output the distance, you should add some text to tell the user what the number represents
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
