0

Im creating a distance formula program that requires 1 space for 2 arguments. I need to make the x1,y1 and x2,y2 be integers. If I try to create them as integers, it will not allow me to enter a space for the 2 arguments. Also, I cannot use split(). How can I create this program with split() and allowing it to be an integer so I can calculate the distance

import math

x1,y1 = input('Please enter the coordinates for the first point:').split()

print('(%s,%s)'%(x1,y1))

x2,y2 = input('Please enter the coordinates for the second point: ').split()

print('(%s,%s)'%(x2,x1))

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

print('The distance from (%s,%s) and (%s,%s) is %s points away from each other')% (x1,y1,x2,y2,Dis_form)
Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0