Python Chapters

Python Program to receive values of latitude and longitude in degress, of two places on earth and outputs the distance between them in nautical miles. The formula for distance in nautical is :
D=3963 cos-1 (sinL1sinL2+cosL1cosL2*cos(G2-G1))

Structure of Python Program - Overview
import math

L1 = input("Enter Two Values of Lattitude :")
L2 = input()

G1 = input("\nEnter Two Values of Longitude :")
G2 = input()

D = 3963 * math.acos(math.sin(L1) * math.sin(L2) + math.cos(L1) * math.cos(L2) * math.cos(G2 - G1));

print "\n\nDistance is :" , D

Output :
Enter Two Values of Lattitude : 50
100
Enter Two Values of Longitude : 150
200

Distance is : 1427.61183891

Leave a comment
Recent Comments
No Comments