Exercise 3: This exercise is inspired by a story about the mathematician Carl Frederich Gauss. When young Gauss was in grade school, his teacher got mad at his class one day. “I’ll keep the lot of you busy for a while”, the teacher said sternly to the group. “You are to add the numbers from 1 to 100, and you are not to say a word until you are done.” 1- Read a new book 2- Display list of unread books 3- Display list of read books 4- quit The teacher expected a good period of quiet time, but a moment later Gauss find the answer. “It’s 5050!” Gauss had realized that if you list all the numbers from 1 to 100, you can always match the first and last numbers in the list and get a common answer: Gauss realized there were exactly 50 pairs of numbers in the range 1 to 100, so he did a quick calculation: 50 * 101 = 5050. Write a program that use a list of numbers. The program should use a while loop to keep popping the first and last numbers from the list and calculate the sum of those two numbers. The program should print out the current numbers that are being added, and print their partial sum. The program should keep track of how many partial sums there are. The program should then print out how many partial sums there were. The program should perform Gauss’ multiplication, and report the final answer. Modify your program so that it works for any set of consecutive numbers, whether that set has an even or odd length Hint: use pop() function to return list items.
simple-tense.com is committed to providing all of its services strictly complying with the applicable laws and regulations; moreover keeping them within the boundaries of ethics. Accordingly, any of its services as offered on its website (essay/dissertation) must not be misunderstood.