Question: Write a function named distance that takes four parameters: the x - and y - coordinates of the first point, followed by the x -
Write a function named distance that takes four parameters: the x and ycoordinates of the first point, followed by the x and ycoordinates of the second point. It should return the distance between those two points, using the Pythagorean Theorem, for which you will need to import the mathLinks to an external site. module and use the math.sqrt function.
Example: d distance; Your function should return d
Example : d distance; Your function should return d
Write a main function that will execute and call the distance function if the file is run as a script, but not if the file is imported into another file. Test it out by running it as a script and by creating another file that imports it and running that file as a script.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
