Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is my original python works please tell me how to improve it to do the addtional requirement pls #take inputs initial_position = float(input(Enter the
This is my original python works please tell me how to improve it to do the addtional requirement pls
#take inputs
initial_position = float(input("Enter the initial position: ")) initial_velocity = float(input("Enter the initial velocity: ")) acceleration = float(input("Enter the acceleration: ")) time_past=float(input("Enter the time past: "))
#calculate distance final_distance= initial_position+initial_velocity*time_past+0.5*(acceleration)*(time_past)*(time_past)
#print distance print("The final distance is "+str(final_distance))
Improved Object Position Calculation Programming Assignment This programming assignment begins with the program you wrote for the Object Position Calculation assignment and incorporates additional requirements. Here are the requirements from the first programming assignment: The final position, f,of an object that has an initial position Xo. an initial velocity Vo and an acceleration of a after a time t has passed is given by the formula: 0 2 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 above equation. Here are the additional requirements for this programming assignment User input may not cause the program to crash. Exceptions from Invalid user nput must be handled gracefully. The user is to be given feedback about invalid input and given the opportunity to supply the input without needing to run the program again. Negative elapsed times are not to be accepted from the user. If a negative time is provided the user is to be given feedback and asked again for the time. Other inputs are to be allowed to be negative, zero, or positive. Only elapsed times are to be restricted to O and positive values. After each calculation the user is to be prompted if they want to perform another calculation. If they answer with a "y" then they are to be prompted for new input and another calculation is to be performed. If they provide any other response the program is to exit. Make sure you read the Interactive Input and Exception Handling.pdf document in its entirety before doing this assignment
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started