Question: Program 6 Write and test a program to accept list of numbers from user. The program will have a function to calculate the square of

Program 6

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

This is to be done with Python Code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!