how to make a distance function in python
import math
p1 = [4, 0]
p2 = [6, 6]
distance = math.sqrt( ((p1[0]-p2[0])**2)+((p1[1]-p2[1])**2) )
print(distance)
how to make a distance function in python
import math
p1 = [4, 0]
p2 = [6, 6]
distance = math.sqrt( ((p1[0]-p2[0])**2)+((p1[1]-p2[1])**2) )
print(distance)
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")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us