subject

In this assignment, you will revisit reading data from a file, and use that data as arguments (parameters) for a number of functions you will write. You will need to:Write and test a function square_each(nums)Where nums is a (Python) list of numbers. It modifies the list nums by squaring each entry and replacing its original value. You must modify the parameter, return will not be allowed!Write and test a function sum_list(nums)Where nums is a (Python) list of numbers. It returns the sum of the numbers in passed-in the list. Write and test a function to_numbers(str_list)Where str_list is a list of strings, each of which represents a number. Modify each entry in the list by converting it to a number. You can choose to use return the list, or just modify str_list in-place, similar to #1, above. Write and test a function main()Take the previous three functions and construct a main() function that will call these functions properly. The program computes the sum of the squares of numbers read from a file. Your program should prompt for a file name and print out the sum of the squares of the values in the file. Hint: use readlines()You may download two example files of numbers to read in, numbers (space seperated)or numbers (comma seperated). You may choose to read in numbers in another format of your choosing, http://www. pas. rochester. edu/~rsarkis/csc161/_static/misc/nu mbers. txt, and http://www. pas. rochester. edu/~rsarkis/csc161/_static/misc/nu mbers_csv. txt so long as you choose one method and document it in your program comments. OutputThis example parses the numbers_csv. txt file. The result should be the same regardless of which input data was used. This program computes the sum of the squares of numbers read from a file. Please enter the file name: numbers_csv. txtThe sum of the squares of the numbers in the file is 32932.0

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Which option should u select to ignore all tracked changes in a document
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
You know the right answer?
In this assignment, you will revisit reading data from a file, and use that data as arguments (param...
Questions
question
Mathematics, 12.02.2021 14:00
question
Computers and Technology, 12.02.2021 14:00
question
Physics, 12.02.2021 14:00
Questions on the website: 13722363