Here we can find the acceleration (a), final velocity(v), initial velocity(u) and time(t) using the formula a = (v-u)/t.
At first, functions are defined for all four types of calculations, in which they will accept three inputs and assign the value in three different variables. Then the fourth value is calculated using the acceleration formula and the calculated value is returned. We are going to use the same acceleration formula in different approaches.
- In the first approach, we will find initial velocity by using the formula “u = (v-a*t)”
- In the second approach, we will find final velocity by using formula “v = u + a*t”
- In the third approach, we will find acceleration by using formula “a = (v – u)/t”
- In the fourth approach, we will find time by using formula “t = (v – v)/a”
Example 1: Initial velocity (u) is calculated.
Initial velocity = 0.1999999999999993
Example 2: Final velocity (v) is calculated.
Final velocity = 19.8
Example 3: Acceleration (a) is calculated.
Acceleration = 9.8
Example 4: Time (t) is calculated.
Time taken = 1.0204081632653061
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.