Question: Problem 1 Write a Python program to do the following: (A) Ask the user to enter as many integers from 1 to 10 as he/she

Problem 1

Write a Python program to do the following:

(A) Ask the user to enter as many integers from 1 to 10 as he/she wants. Store the integers entered by the user in a list. Every time after the user has entered an integer, use a yes/no type question to ask whether he/she wants to enter another one.

(B) Display the list.

(C) Calculate and display the average of the integers in the list.

(D) If the average is higher than 7, subtract 1 from every number in the list. Display the modified list.

The following is an example:

Enter an integer from 1 to 10: 5

Enter another integer? [y/n] y

Enter an integer from 1 to 10: 8

Enter another integer? [y/n] y

Enter an integer from 1 to 10: 9

Enter another integer? [y/n] y

Enter an integer from 1 to 10: 7

Enter another integer? [y/n] y

Enter an integer from 1 to 10: 8

Enter another integer? [y/n] n

Number list: [5, 8, 9, 7, 8]

Average: 7.4

Modified number list: [4, 7, 8, 6, 7]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!