Store Sales in Python
Write a program that uses nested for loops to collect sales data per store and calculate the total and average sales for specified months. The program should first ask for the number of stores and the number of months. After each store iteration it should display the average and total sales for that store. After all iterations, the program should display the total and average sales for all the stores
If you have any doubts, please give me comment...
no_stores = int(input("Enter the number of stores: "))
months = int(input("Enter number of months: "))
net_total = 0
for store in range(1, no_stores+1):
total = 0
for month in range(1, months+1):
sales = float(input("\nEnter store "+str(store)+", month "+str(month)+" sales: "))
total += sales
average = total/months
net_total += total
print("Store "+str(store)+" average sales: "+str(average))
print("Store "+str(store)+" total sales: "+str(total))
net_average = net_total/no_stores
print("Total average sales: "+str(net_average))
print("Net total sales: "+str(net_total))
Get Answers For Free
Most questions answered within 1 hours.