PYTHON   26

distance between 2 points

Guest on 13th November 2021 07:55:55 AM

  1. import math
  2. x1 = input("enter x1 ")
  3. x2 = input("enter x2 ")
  4. y1 = input("enter x1 ")
  5. y2 = input("enter x2 ")
  6.  
  7.  
  8.  
  9. dist = sqrt( (x2 - x1)**2 + (y2 - y1)**2 )
  10.  
  11. print("distance between point1 and 2 is " + dist)

Raw Paste


Login or Register to edit or fork this paste. It's free.