Tausif K.

asked • 04/26/21

write a python program

Consider the following formula and evaluate the y value for the range of t values found in a file with format 𝑦(𝑡) = 𝑣0𝑡 − 0.5𝑔𝑡

File Format:

v0 3.0

t:

0.15592 0.28075 0.36807889 0.35 0.57681501876 0.21342619 0.0519085 0.042 0.27 0.50620017 0.528 0.2094294 0.1117 0.53012 0.3729850 0.39325246 0.21385894 0.3464815 0.57982969 0.10262264 0.29584013 0.17383923


i. Write a function that reads the input file and returns v0 and a list with the t values.

ii. Write a function that creates a file with two nicely formatted columns containing the t values to the left and the corresponding y values to the right. Let the t values appear in increasing order (note that the input file does not necessarily have the t values sorted).

iii. Make a test function that generates an input file, calls the function for reading the file, and checks that the returned data objects are correct.

iv. Write a function which handle the exception handling for the availability of file or not.

1 Expert Answer

By:

Rize S. answered • 03/23/23

Tutor
New to Wyzant

Senior IT Certified Trainer, IT Developer & DBA Administrator

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.