In: Computer Science
How do I calculate the total of all invoices?
Here is my code:
# Part F Calculate the total of invoices
invoices=[]
invoices.append((83,'Electric Sander',7,57.98))
invoices.append((24,'Power Saw',18,99.99))
invoices.append((7,'Sledge Hammer',11,21.50))
invoices.append((77,'Hammer',76,11.99))
invoices.append((39,'Jig Saw',3,79.50))
print('\nThe total of all invoices is', invoice)
for invoice in invoices:
print(invoice)
# Part F Calculate the total of invoices
invoices=[]
invoice = 0
invoices.append((83,'Electric Sander',7,57.98))
invoices.append((24,'Power Saw',18,99.99))
invoices.append((7,'Sledge Hammer',11,21.50))
invoices.append((77,'Hammer',76,11.99))
invoices.append((39,'Jig Saw',3,79.50))
for unit_invoice in invoices:
invoice = invoice + unit_invoice[2]*unit_invoice[3]
print('\nThe total of all invoices is', invoice)
====================================================
SEE OUTPUT
Thanks, PLEASE COMMENT if there is any concern. PLEASE UPVOTE