Answer:
#section 1
ls = []
while True:
score = float(input('Enter a New score or negative number to exit: '))
if score < 0:
break
else:
ls.append(score)
#section 2
average = sum(ls)/len(ls)
a = [num for num in ls if num >= average]
print('Total Scores Entered: ',len(ls))
print('Average score entered is: ',average)
print('Number of scores above average is: ',len(a))
print('Number of scores below average is:', len(ls)-len(a))
Explanation:
The programming language used is python 3.
#section 1
In this section, an empty list is initialized to hold all the values that will be inputted.
A while loop created which prompts the user to enter an input until a negative value is entered. This while loop always evaluates to be true until a value less than 0 allows it to break.
Finally, all the scores are appended to the list.
#section 2
In this section the code gets the average by dividing the sum by the number of items in the list.
A new list 'a' is created to hold all the values that are greater than or equal to the average.
Finally, the results are printed to the screen.
I have attached an image with the example stated in your question.