(Solved):Girl Scout Troop 815 has 25 members. Write a program in which the troop leader can enter the number of boxes of cookies sold by each scout and output the total number of boxes sold and the mean and… View Answer…

 

Question

Girl Scout Troop 815 has 25 members.

Write a program in which the troop leader can enter the number of boxes of cookies sold by each scout and output the total number of boxes sold and the mean and median value.

 

EXPERT ANSWER

no_boxes=[]
for i in range(1,26):
    box=int(input("Enter number of boxes sold by scout "+str(i)+": "))
    no_boxes.append(box)
total_boxes=sum(no_boxes)
mean=total_boxes/len(no_boxes)
sort=sorted(no_boxes)
median=sort[int(len(no_boxes)/2)]
print ("Total boxes sold: "+str(total_boxes))
print ("Mean: "+str(mean))
print ("Median: "+str(median))

Insert answer here…

We are so

Scroll to top