distance between two coordinates python code example

Example 1: python distance of coordinates

dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)

Example 2: calculate distance in python

from math import sqrt
def main():
	point1x, point1y = eval(input("Please enter coordinates of Point1 (use commas) "))
	point2x, point2y = eval(input("Please enter coordinates of Point2 (use commas)"))
	
	Distance = sqrt((point1x-point2x)**2 + (point1y-point2y)**2)
	print("The distance between this two points is", str(round(Distance, 4))+" units")

Example 3: python distance between coordinates

import geopy.distance

coords_1 = (52.2296756, 21.0122287)
coords_2 = (52.406374, 16.9251681)

print geopy.distance.distance(coords_1, coords_2).km