Question
Write a program that includes the following three functions. (Refer to exercises 11, 12, 13, and 14 of Chapter 6.) Functions squareEach(nums) In this function,
Write a program that includes the following three functions. (Refer to exercises 11, 12, 13, and 14 of Chapter 6.) Functions squareEach(nums) In this function, nums is a list of numbers. It modifies the list by squaring each entry. sumList(nums) In this function, nums is a list of numbers. It returns the sum of numbers in the list. toNumbers(strList) In this function, strList is a list of strings, each of which represents a number. It modifies each entry in the list by converting it to a number. Use the functions above to implement a program that computes the sum of the squares of numbers read from the file. You should create and save a file with one line and a list of numbers, each separated by a space. An example would be a file with the following contents: 13 34 14 53 56 76. Your program should prompt for a file name (the name you used when you saved the file) and print or display the sum of the squares of the values in the file. Hint: use readlines().
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started