Using Python: I can't get it to loop and then add the total. Here is my code. What am I doing wrong and how would you code this. see attachemnt

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using Python:

I can't get it to loop and then add the total. Here is my code. What am I doing wrong and how would you code this. see attachemnt

#Create a variable to control the loop.
total_amount = 0

#Calculate a series of price items.

while total_amount != '0':

#Get the input from the user for the price of the ticket.

ticket_price = float(input("Enter the ticket price of the item or zero to quit: "))

#Get the input from the user for the reduced item.

reduced_item = input("Is this item reduced y/n? ")

#Get the input from the user for the taxable item.

tax_item = input("Is this item taxable y/n? ")

#Display the outputs

print("Bill for this item")
print("Original price $", format(ticket_price, ",.2f"), sep="")

#Check the reduced item.
#If item is reduced, then calculate the reduced price.
reduced = (ticket_price *25) / 100

#Display the reduction
print("Reduction during the event $", format(reduced, ",.2f"), sep="")

#Display the outputs for the final price.

final_price = ticket_price - reduced
print("Final price $", format(final_price, ",.2f"), sep="")

#Calculate the sales tax.
tax_item = (final_price * 7) / 100
tax_item = 0
#Display the output.
print("7% Sales tax $", format(tax_item, ",.2f"), sep="")

#Calculate the subtotal.
sub_total = final_price + tax_item

#Display the output
print("Item subtotal $", format(sub_total, ",.2f"), sep="")

#set accumulator to 0.
total = 0.0
total = total + sub_total

#Display the output for all total items if user does not
#want to price another item.

total_amount = input("Enter the ticket price of the item or zero to quit: ")
print("Total amount due $" ,format(total, ",.2f"), sep="")

 

SPC Home Page || St. Petersburg Coll ×
SPC Student Login - One SPC
Module 4 Assignment - COP100 x
b Answered: Write a program that
A https://mycourses.spcollege.edu/d2l/le/content/254774/viewContent/10567653/View
program4_1.py
Refer to the Trader Jane's program in module3. Copy it and enhance it so multiple items can be handled by the program. Use a while loop . This improved
program should output the total for all items.
Sample Output
Enter the ticket price of the item or zero to quit 100
Is this item reduced y/n? y
Is this item taxable y/n? n
Bill for this item
Original price $100.00
Reduction during event $25.00
Final price $75.00
7% Sales tax $0.00
Item subtotal $75.00
Enter the ticket price of the item or zero to quit 100
Is this item reduced y/n? n
Is this item taxable y/n? y
Bill for this item
Original price $100.00
Reduction during event $0.00
Final price $100.00
78 Sales tax $7.00
Item subtotal $107.00
Enter the ticket price of the item or zero to quit 0
Total amount due $182.00
program4_2.py
Write a program that displays a table of inches from 1-12 and equivalent lengths in centimeters. You can find the conversion factor online if necessary. Store
this factor in a properly named constant in your program. Display the inches accurate to one decimal place in a column 6 characters wide and the
centimeters accurate to two decimal places in a column 8 characters wide (see page 71). See Required Output.
11:33 PM
へロ ) G
99+
10/7/2020
Transcribed Image Text:SPC Home Page || St. Petersburg Coll × SPC Student Login - One SPC Module 4 Assignment - COP100 x b Answered: Write a program that A https://mycourses.spcollege.edu/d2l/le/content/254774/viewContent/10567653/View program4_1.py Refer to the Trader Jane's program in module3. Copy it and enhance it so multiple items can be handled by the program. Use a while loop . This improved program should output the total for all items. Sample Output Enter the ticket price of the item or zero to quit 100 Is this item reduced y/n? y Is this item taxable y/n? n Bill for this item Original price $100.00 Reduction during event $25.00 Final price $75.00 7% Sales tax $0.00 Item subtotal $75.00 Enter the ticket price of the item or zero to quit 100 Is this item reduced y/n? n Is this item taxable y/n? y Bill for this item Original price $100.00 Reduction during event $0.00 Final price $100.00 78 Sales tax $7.00 Item subtotal $107.00 Enter the ticket price of the item or zero to quit 0 Total amount due $182.00 program4_2.py Write a program that displays a table of inches from 1-12 and equivalent lengths in centimeters. You can find the conversion factor online if necessary. Store this factor in a properly named constant in your program. Display the inches accurate to one decimal place in a column 6 characters wide and the centimeters accurate to two decimal places in a column 8 characters wide (see page 71). See Required Output. 11:33 PM へロ ) G 99+ 10/7/2020
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education