Question: Using Python. I did the function like this, but it cannot run correctly. def main (): m1 = float(input('enter mass1:')) m2 = float(input('enter mass2:')) d
Using Python.
I did the function like this, but it cannot run correctly.
def main (): m1 = float(input('enter mass1:')) m2 = float(input('enter mass2:')) d =float(input('enter the distance between m1 and m2:')) k =float(6.67* 10**(-8)) F = (k*m1*m2)/d**2 print(F) main()

According to Newton's universal law of gravitation, the force F between two bodies with masses M1 and M2 is computed as where d is the distance between the two bodies and k is a positive real number called the gravitational constant. The gravitational constant k is approximately equal to 6.67 10-8 dyn-cm2 / g2 Write a program that 1. Reads from the keyboard the mass for the the two bodies in grams g, the distance between the two bodies in centimeters cm, and then 2. Computes the force F. Here is an interesting fact: the force between the Earth and the moon is 1.984 1025 dyn, the mass of the earth is 5.983 x 1027 g, the mass of the moon is 7.347 x 1025 g, and the distance between the two is 3.844 x 1010 crm. This may help you determine if your program is working correctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
