10 lines
441 B
Python
10 lines
441 B
Python
|
from math import radians, sin, cos, acos
|
||
|
|
||
|
print("Input coordinates of two points:")
|
||
|
slat = radians(float(input("Starting latitude: ")))
|
||
|
slon = radians(float(input("Ending longitude: ")))
|
||
|
elat = radians(float(input("Starting latitude: ")))
|
||
|
elon = radians(float(input("Ending longitude: ")))
|
||
|
|
||
|
dist = 6371.01 * acos(sin(slat)*sin(elat) + cos(slat)*cos(elat)*cos(slon - elon))
|
||
|
print("The distance is %.2fkm." % dist)
|