Write a function that creates a file with two nicely columns

Assignment Help Programming Languages
Reference no: EM131321626

Evaluate a formula for data in a file

We consider the formula y(t) = v0t - 0.5gt2 and want to evaluate y for a range of t values found in a file with format

v0: 3.00

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

More precisely, the first two lines are always present, while the next lines contain an arbitrary number of t values on each line, separated by one or more spaces.

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

b) 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).

c) 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. Filename: ball_file_read_write.py

Reference no: EM131321626

Questions Cloud

Project acceptance should be based on the NPV : You are on the staff of Camden Inc. The CFO believes project acceptance should be based on the NPV, but Steve Camden, the president, insists that no project should be accepted unless its IRR exceeds the project's risk-adjusted WACC. What is your opti..
Analyze inventory valuation methods : Analyze inventory valuation methods discussed in the textbook. Based on your analysis, recommend the most accurate valuation method that reflects current economic conditions. Provide a rationale for your recommendation
What is present value of this investment : An investment will pay $2,566 two years from now, $2,243 four years from now, and $2,639 five years from now. If the opportunity rate is 6.98 percent per year, what is the present value of this investment?
Discuss the merits and demerits of computer freezing : One of the methods used in extracting computer forensics evidence is to freeze the computer. While this is considered a good approach by many people, there are those who think it is shoddy work. Discuss the merits and demerits of computer "freezin..
Write a function that creates a file with two nicely columns : 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.
Write a test program for tracking their course sections : A college wants to you to write a test program for tracking their course sections. Classroom capacities on campus range from a minimum of 1 student to a maximum of 30 students.
Present value and future value of this cash flow stream : Claire Conscience has shares of an oil well that only occasionally generates any income. Her projections are that she will receive $200 in year 1, $1,000 in year 3, and $500 in year 4. If Claire’s opportunity cost is 5.5%, what is the present value a..
What is a bastion router : Search and discuss as many services and protocols as possible offered by a modern firewall.
Pressure inside the eardrum does not change : Assume that the air pressure inside and out are balanced when you leave Denver, the pressure inside the eardrum does not change, and that the density of the air is constant and is equal to 0.80 kg/m3.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a code to swap the letter passed through an array

Write a code to swap the letter passed through an array called letters. With int number of letters. Use must use pointers and pointer arithmetic.

  Write a program that uses is and else or if and elsif

write a program that uses is and else or if and elsif conditional statementsthat asks the user to enter a value for

  1 for each parka obermeyer faces the situation of possibly

1. for each parka obermeyer faces the situation of possibly producing too much or too little compared to actual

  Display policy data after revisions have made

The day is not correct for the month (that is, between 1 and 31 for January, 1 and 29 for February, and so on), then set the month, day, and year to 0. Display the policy data after any revisions have been made.

  What does the abstract keyword do

Which parts of the assignment were you not able to complete fully? For each, explain why you were unable to complete this part and what steps you took to attempt to complete it. Give me as much detail as possible such that I may award partial cred..

  Methods to declare and initialize one dimensional arraay

What is an array? Show different methods to declare and initialize one dimensional array. Draw how an integer array of 6 elements having base address 5001 is stored in memory.

  Write a powershell script changenames

Create a batch file CHANGENAMES.BAT that does the following (note that %1, %2, and %3 refer to command line arguments passed to the batch file when executed): Creates a set of %1 empty files with randomly generated names, with filename extension %2..

  Find the sum and difference for numbers

Write a program that prompts the user for two numbers, finds the sum and difference for those numbers and displays a descriptive label for each computation by calling two different functions. Use Function Prototypes.

  Write program to accept five input values in array

Write a program that accepts five input values and stores them into an array. The program should display those five numbers in reverse order.

  Write a marie program using a loop

Write a MARIE program using a loop that multiplies two non-negative numbers by using repeated addition. For example, to multiply 3 x 6, the program would add 3 six times (e.g. 3 + 3 + 3 + 3 + 3 + 3) or add 6 three times (e.g. 6+6+6). You should wr..

  Logarithmic scale for the x- and y-axes

Graph the functions 8n, 4nlogn, 2n2, n3, and 2n using a logarithmic scale for the x- and y-axes.

  Program display error message if test score is invalid

The program must display suiatble letter grade. The program must display an error message if the test score is 100.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd