Question: In this lab you will revisit reading data from a file and use that data as arguments (parameters) for several functions you will write. 54636342834222278852

In this lab you will revisit reading data from a file and use that data as arguments (parameters) for several functions you will write. 54636342834222278852 You will need to: 1. Write 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! 2. Write 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. 3. Write 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. 4. Write a function to_file(answer) - Where answer is the sum of each squared number. Write the answer to a new text file called Project_3_answer. 5. Write a function main() - Take the previous four 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 and outputs it in a new text file. Your program should prompt for a file name and write the sum of the squares of the values in a new file. Hint: use readines() Output This program should create a text file with the sum of the numbers squared inside. The number should be 32932 The result should be the same regardless of which input data was used (numbers space separated, or numbers comma separated)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
