Question
Write and test a program to accept list of numbers from user. The program will have a function to calculate the square of each number
Write and test a program to accept list of numbers from user. The program will have a function to calculate the square of each number in the list and a list containing the square of each number in the list and a function to calculate and return the sum for all the numbers in the list
squareEach(nums) is a function that modifies the list by squaring each entry and returns the list of squares for each number in the list, nums is a list of numbers
sumList(nums) is a function to sum numbers in a list and return the sum; nums is a list of numbers
Remember that squaring a number means multiplying it by itself so if I pass you a 7, you need to return it as a 49 (7*7)
Test your program with a sequence holding 1,2,3,4,5,6,7,8 and returning a sequence 1,4,9,16,25,35,49,64
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