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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, Twitches
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
image
Computers and Technology, 22.06.2019 15:00, vladutraileanu7599
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
image
Computers and Technology, 24.06.2019 01:30, BIKRAMlawati5544
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
image
Computers and Technology, 24.06.2019 21:30, breannaasmith1122
Along what line of action can the camera move to follow the movement of actors for screen direction? a. along a 90-degree arcb. along a 120-degree arcc. along a 180-degree arcd. along a 360-degree arc
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 in other subjects:

Konu
Chemistry, 17.03.2021 23:50