188k views
19 votes
Compute the approximate acceleration of gravity for an object above the earth's surface, assigning accel_gravity with the result. The expression for the acceleration of gravity is: G*M)/(d), where G is the gravitational constant 6.673 x 10-11 M is the mass o the earth 5.98 x 1024 (in kg), and d is the distance in meters from the Earth's center stored in variable dist_center) Sample output with input: 6.3782e6 (100 m above the Earth's surface at the equator) Acceleration of gravity: 9.81 1 G = 6.673e-11 2 M = 5.98e24 3 accel_gravity = 0.0 5 dist_center = float(input()) " Your solution goes here" 10 000 9 print('Acceleration of gravity: {: .2f}'.format(accel_gravity)

User Tunecrew
by
2.8k points

1 Answer

13 votes

Answer:

G = 6.673e-11

M = 5.98e24

accel_gravity = 0.0

dist_center = float(input())

accel_gravity = (G * M) / (dist_center * dist_center)

print('Acceleration of gravity: {: .2f}'.format(accel_gravity))

Step-by-step explanation:

The G, M, and accel_gravity are already initialized

The user is asked to enter the dist_center which is the only missing thing in the formula

In order to calculate the accel_gravity, you just need to put the variables in the formula (Note that the formula is (G*M)/(d^2), not d)

Then, the calculated value of accel_gravity is printed

User ZdaR
by
3.5k points