subject

Write and test a program to sum and modify a list of numbers. The program will have two functions: sumList(nums) is a function to sum numbers in a list and return the sum squareEach(nums) is a function that modifies the list by squaring each entry The main program should prompt the user for a number n, and use that to create a list of numbers, nums (see ch6ex12.py). It will then make a call to sumList(nums), then make a call to squareEach(nums), and then call sumList(nums) a second time. The program should print the original list, the sum of the original list, the list after being squared, and the sum of the elements in the updated list. 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 list [1,2,3,4,5,6,7,8], which should print a sum of 36, a list [1,4,9,16,25,36,49,64], and a second sum 204 Save this as lastname_program5.py and submit on Brightspace You must submit your source code as a .py file. The code should be well-structured and commented. A screen shot of the program displaying all required output FOR EACH FEATURE OF YOUR PROGRAM and your name, class, and program number

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:20
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
Companies that implement and apply an information system effectively can create
Answers: 1
You know the right answer?
Write and test a program to sum and modify a list of numbers. The program will have two functions: s...
Questions