Computers and Technology

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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:20, babyrocks7300
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
image
Computers and Technology, 23.06.2019 04:31, tbt81
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
image
Computers and Technology, 24.06.2019 16:50, bella7524
7.23 main lab 7 - online shopping cart background this main lab extends the earlier prep lab "online shopping cart part 1". (you should save this as a separate project from the earlier prep lab). you will create an on-line shopping cart like you might use for your on-line purchases. the goal is to become comfortable with setting up classes and using objects. requirements this lab can be done individually or as pair programming. expanded itemtopurchase class (15 points) extend the itemtopurchase class as follows. we will not do unit testing in this lab so we will not be giving you the names of the member functions. create good ones on your own. create a parameterized constructor to assign item name, item description, item price, and item quantity (default values of "none" for name and description, and 0 for price and quantity). additional public member functions set an item description get an item description print the cost of an item - outputs the item name followed by the quantity, price, and subtotal (see example) print the description of an item - outputs the item name and description (see example) additional private data members a string for the description of the item. example output of the function which prints the cost of an item: bottled water 10 @ $1.50 = $15.00 example output of the function which prints the item description:
Answers: 1
image
Computers and Technology, 24.06.2019 20:20, isaiahromero15
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
Do you know the correct answer?
Write and test a program to sum and modify a list of numbers. The program will have two functions: s...

Questions in other subjects:

Konu
Mathematics, 28.02.2020 18:40
Konu
Physics, 28.02.2020 18:43
Konu
Social Studies, 28.02.2020 18:43
Konu
Computers and Technology, 28.02.2020 18:43