Solution Found!
Use the functions from the previous three problems to implement a program that computes
Chapter 6, Problem 14(choose chapter or problem)
Use the functions from the previous three problems to implement a program that 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 ()
Questions & Answers
QUESTION:
Use the functions from the previous three problems to implement a program that 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 ()
ANSWER:Step 1 of 3
The program is written to read the numbers of a file and find the sum of squares of the numbers. The three functions used are:
1. squareEach(nums) : Modifies the nums list by squaring each entry.
2. sumList(nums) : Returns the sum of the numbers in the list nums.
3. toNumbers(strList) converts each string in strList to number.