Computer Science, asked by mbhostindia, 2 months ago

Write a program in python to accept a number of Zones of Edutech from the user. The program should store sales values if each deptt in the list.

Program is expected to :

accept the sales one by one from the user and add it at the beginning

(ii) find the average of sales in the list

(iii) sort the sales values within the list

(iv) should display the how many sales values are same as the average sales value

appears in the list.

For example: it list entered by the user is [1000,2000,4,000,3000,4000,2000,4000,5000,2000,3000]

then the average of the elements is 3000 and it should display that average value 3000 appears 2 times in the list.​

Attachments:

Answers

Answered by Equestriadash
9

The following co‎des have been written using Python.

n = int(input("Enter the number of sales values: "))

print()

l = list()

#accepting the values and adding them at the beginning of the list

for i in range(n):

   s = int(input("Enter the sales value: "))

   l.insert(0, s)

   print()

print()

print(l, "is the list of sales values.")

print()

#finding the average of the list

avg = sum(l)/len(l)

print(avg, "is the average sales value.")

print()

#sorting the values in the list

l.sort()

print(l, "is the sorted list.")

print()

#finding the number of times the average value occurs in the list

c = 0

for i in l:

   if i == avg:

       c = c + 1

print(avg, "occurs", c, "times in the list.")

Similar questions