Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this programming assignment you will write and submit your first interactive

ID: 3875305 • Letter: I

Question

In this programming assignment you will write and submit your first interactive Python program. In the program you will accept user input, perform a calculation, and display the result. You will learn best practices in naming variables and creating user interfaces. Write a python program called objectposncalc.py that accepts user input from the keyboard for the initial position, initial velocity, acceleration, and time that has passed and outputs the final position based on the following equation. The final position, x_f, of an object that has an initial position x_0, an initial velocity v_0, and an acceleration of a after a time t has passed is given by the formula: x_f = x_0 + v_0 t + 1/2 at^2 For example, if an object has an initial position of 4.2 meters, an initial velocity of 2.3 meters/second, and an acceleration of 5.8 meters/second^2, the final position of the object after 8.0 seconds can be calculated as follows. x_0 = 4.2 v_0 = 2.3 a = 5.8 t = 8.0 x_f = 4.2 + 2.3 * 8.0 + 0.5 * 5.8 * 8.0^2 x_f = 4.2 + 2.3 * 8.0 + 0.5 * 5.8 * 64.0 x_f = 4.2 + 18.4 + 185.6 x_f = 208.2 The final position of the object is 208.2 meters.

Explanation / Answer

Please find below the code and if you have any doubt please comment

#take inputs

initial_position = input("Enter the initial position: ")
initial_velocity = input("Enter the initial velocity: ")
acceleration = input("Enter the acceleration: ")
time_past=input("enter the time past")

#calculate distance
final_distance = initial_position*1.0+initial_velocity*time_past*1.0+0.5*(acceleration)*(time_past)*(time_past)

#print distance
print("The final distance is "+str(final_distance));

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote