0

Hello again, I am working on a homework problem and I am not able to get the accumulator to accumulate the tickets sales for each section.

My assignment is to create a basic program that will use loops. I need to have it ask for each day of the week how many tickets were sold in each category. Also I need it to accumulate the total were sold throughout the week within each category. I played around with what I have now and it seems to only accumulate what the last day is not each day. Can someone help me figure out what I am doing wrong? Also if you have any tips for a better way of coding it I am trying to learn as much as possible. (please understand this is a fundamentals class though :P )

```
def main():
#Seat pricing per section
classA = 15
classB = 12
classC = 9
#Number of days
week = 7
#Loop to ask for and recieve user input for how many sold in each section
for sales_week in range (week):
totalA = 0
totalB = 0
totalC = 0
print('For day', sales_week+1)
print('---------')
ticketA = int(input('Enter the number of Class A seats were sold: '))
ticketB = int(input('Enter the number of Class B seats were sold: '))
ticketC = int(input('Enter the number of Class C seats were sold: '))
print('')
totalA += ticketA
totalB += ticketB
totalC += ticketC
seatsA(classA, totalA)
seatsB(classB, totalB)
seatsC(classC, totalC)
grand_total = totalA + totalB + totalC
print('The total of all seats sold is: ', grand_total)
#Fuctions to calculate the totals
def seatsA(price, seats):
classA_Total = price * seats
print('$', classA_Total, ' in Class A seats were sold.', sep='')
def seatsB(price, seats):
classB_Total = price * seats
print('$', classB_Total, ' in Class B seats were sold.', sep='')
def seatsC(price, seats):
classC_Total = price * seats
print('$', classC_Total, ' in Class C seats were sold.', sep='')
main()
```