Python Program To Find The Gravitational Force Between Two Objects 🔥| CyberwarriorsAP |
CyberwarriorsAP
Hey Viewers In this video I'm going to make a python program which'll literally ease your physics calculation for find the value of F (Gravitational Force). It is a simple python program, we need to calculate the gravitational force. It is a beginner-level python program. So, watch this video till end and you'll also be able to make such type of programs for your physics calculations.
And Here's the steps for you.. ALGORITHM STEP 1: Accept the values of two masses and the distance between the center of the masses using the input method and convert that string to float using float data type in python programming.
STEP 2: Calculate the value of G the gravitational constant using the formula G = 6.673*(10**-11). This is needed for calculating the force.
STEP 3: Calculate the gravitational force using the formula f=(Gm1m2)/(r**2), where m1 and m2 are the masses and r is the distance between the center of masses.
STEP 4: Using python programming basics print the value of the gravitational force using the round method two make the result exactly two decimal values.
And Here's the code:-- m1=float(input("Enter the first object: "))
m2=float(input("Enter the second object: "))
r=float(input("Enter the distance between the center of the objects: "))
G=6.673*(10**-11)
f=(Gm1m2)/(r**2)
print("The gravitational force between objects is: ",round(f,2),"N")
Python Program to find the gravitational force between two objects Python Program to find the gravitational force between two objects Python Program to find the gravitational force between two objects Python Program to find the gravitational force between two objects
20269006 Bytes