def findDistance():
first_coord = raw_input("Enter first coordinate set (format x, y): ").split(",")
second_coord = raw_input("Enter second coordinate set (format x, y): ").split(",")
x1 = float(first_coord[0])
x2 = float(second_coord[0])
y1 = float(first_coord[1])
y2 = float(first_coord[1])
print math.sqrt(float(((x2 - x1) * (x2 - x1))) + float(((y2 - y1) * (y2 - y1))))
Putting in the series (10, 12), (12, 10) gives me 2.0, when the actual distance (rounded somewhat) is 2.82842. It appears Python is flooring my number. Why and how is this happening?
Copy&paste error. The line
should be
Of course the result is also rounded to IEEE double precision, but the reason the result is that far off is the above mistake.