please suggest the right forum or site if this is not the correct place, thank you!
Hello all, I am currently having trouble understanding an error I receive when running my code
error:
My code with comments/notes: the error happens in the end when calling showIncome()" I am having trouble within "def showIncome():" as well as calling/figuring out the a/b/cRevenue variables in the print statements. any help or resources explaining this will be greatly beneficial as my teacher and book do not seem to be helping much ( i have tried stackoverflow but reached my question limit this week and am resorting to this forum)
Hello all, I am currently having trouble understanding an error I receive when running my code
error:
1 2 3 4 |
Traceback (most recent call last): File "main.py" , line 32 , in <module> showIncome() TypeError: showIncome() missing 6 required positional arguments: 'num_aTickets' , 'num_bTickets' , 'num_cTickets' , 'aRevenue' , 'bRevenue' , and 'cRevenue' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# Your main function should get the number of seats sold for each category. The values should be sent to a calcIncome function. # The calcIncome function should calculate the income from each category. Those values should be returned to the main function and those values should be sent to the showIncome function. # The showIncome function should calculate the total income generated from the ticket sales, display the income generated from each category AND display the total income generated. def main(): # obtain number of tickets/seats for each type from user num_aTickets = int ( input ( 'Enter number of class a tickets sold: ' )) num_bTickets = int ( input ( 'Enter number of class b tickets sold: ' )) num_cTickets = int ( input ( 'Enter number of class c tickets sold: ' )) return num_aTickets, num_bTickets, num_cTickets def calcIncome(aTickets, bTickets, cTickets): # revenue made from each and returns total revenue from sales aCost = 20 bCost = 15 cCost = 10 aRevenue = aTickets * aCost bRevenue = bTickets * bCost cRevenue = cTickets * cCost return (aRevenue + bRevenue + cRevenue) def showIncome(num_aTickets, num_bTickets, num_cTickets, aRevenue, bRevenue, cRevenue): income = calcIncome(num_aTickets, num_bTickets, num_cTickets) print ( 'the revenue collected from total ticket sales is' , income) print ( 'the revenue collected from class a ticket sales is' , aRevenue) print ( 'the revenue collected from class b ticket sales is' , bRevenue) print ( 'the revenue collected from class c ticket sales is' , cRevenue) showIncome() |