You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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) |