x1, y1 = int(input('x1 = ')), int(input('y1 = '))
x2, y2 = int(input('x2 = ')), int(input('y2 = '))
print(((x2 - x1) * 2 + (y2 - y1) * 2) ** .5)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
def distance(x1, y1, x2, y2):
return math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
x1 = int(input("Enter x1: "))
y1 = int(input("Enter y1: "))
x2 = int(input("Enter x2: "))
y2 = int(input("Enter y2: "))
print("Distance:", distance(x1, y1, x2, y2))
Verified answer
x1, y1 = int(input('x1 = ')), int(input('y1 = '))
x2, y2 = int(input('x2 = ')), int(input('y2 = '))
print(((x2 - x1) * 2 + (y2 - y1) * 2) ** .5)