Please make a code this problem in python
When the sales volume of 12 months
January 10, February 5, March 23, April 70, May 65, June 33, July 81, August 29, September 28,October 48, November 91, December 88
first quarter is January – March, Second quarter is April – June, Third is July – september, Fourth is October – December
Code a program which output each quarter of average sales volume in Python (You must use for or while sentences in code!)
Expert Answer
sales=[(‘January’,10),(‘February’,5),(‘March’,23), (‘April’,70), (‘May’,65),(‘June’,33), (‘July’,81), (‘August’,29), (‘September’,28),(‘October’,48),
(‘November’,91),(‘December’,88)]
def printAverageSales():
print(“QuarterWise Average Sales (in Volume):n………………………………”)
totalVolume=0;
quarter=1
for month,volume in sales:
totalVolume+=volume
if(month==”March” or month==”June” or month==”September” or month==”December”):
print(“Quarter “,quarter,”:”,(totalVolume/3))
totalVolume=0
quarter+=1
printAverageSales()
Indentation:
Output:
Note: use python 3 or above