Skip to content

Instantly share code, notes, and snippets.

@ebovio
Created April 16, 2017 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebovio/e4300d1ef2cf9b812fce0983cfa1f308 to your computer and use it in GitHub Desktop.
Save ebovio/e4300d1ef2cf9b812fce0983cfa1f308 to your computer and use it in GitHub Desktop.
#Problem1
import math
def dist(x1, y1, x2, y2):
x = x2-x1
y = y2-y1
z = (x**2) + (y**2)
ans= math.sqrt(z)
return ans
#MainProgramBelow
x1 = float(input("Write the x value for the first coordinate"))
y1 = float(input("Write the y value for the first coordinate"))
x2 = float(input("Write the x value for the second coordinate"))
y2 = float(input("Write the y value for the second coordinate"))
print("The distance in between the two coordinates is:", dist(x1, y1, x2, y2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment