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 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 23.06.2019 20:10
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Which best describes the condition under which the unicode output is the same as plain text ?
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
Python. primary u.s. interstate highways are numbered 1-99. odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. thus, the 405 services the 5, and the 290 services the 90. given a highway number, indicate whether it is a primary or auxiliary highway. if auxiliary, indicate what primary highway it serves. also indicate if the (primary) highway runs north/south or east/west.
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
Biology, 26.03.2021 20:00
question
Mathematics, 26.03.2021 20:00
question
Physics, 26.03.2021 20:00
Questions on the website: 13722363