Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions