This program estimates Earth’s gravitational acceleration given the latitude and elevation (in meters).
For this calculation, consider the absolute value of the latitude. Gravity acceleration is the a given the northern latitude north and the corresponding southern latitude. (Example: gravity is about 9.79325 m/s² at 30° north and 30° south).
Sources: Bislin, Walter. “Earth Gravity Calculator” September 1, 2018. https://walter.bislins.ch/bloge/index.asp?page=Earth+Gravity+Calculator Retrieved January 15, 2026.
Glover, Thomas J. and Richard A. Young Desk Ref Sequoia Publishing, Inc. Anchorage, AK. 4th Edition, 2022. Soft Cover ISBN 978-1-885071-60-6. pg. 587
“Gravity of Earth” Wikipedia. Last edited January 31, 2026. https://en.wikipedia.org/wiki/Gravity_of_Earth Retrieved February 1, 2026.
from math import * # constants # equator: radius, gravity a=6378137 ga=9.7803253359 # poles: radius, gravity b=6356721.3142 gb=9.8321849378 print("Latitude:","\nNorth or South") d=eval(input("Decimal? ")) m=eval(input("Minutes? ")) s=eval(input("Seconds? ")) phi=radians(d+m/60+s/3600) print("Height (m)?") h=eval(input("? ")) gs=a*ga*cos(phi)**2+b*gb*sin(phi)**2 gs/=sqrt((a*cos(phi))**2+(b*sin(phi))**2) print("Gravity on the surface:") print(str(gs)," m/s**2") print("At altitude: ",str(h)," m") ge=(100*gs-0.3086*h/1000)/100 print(str(ge)," m/s**2")