Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with the following question. At the bottom of this question I've attached a previous similar program that I wrote for this class,

I need help with the following question. At the bottom of this question I've attached a previous similar program that I wrote for this class, but I don't know how to add the indeterminate number of inputs in a while loop together to make the new program. I'm NOT asking for the question to be completed for me, I just need help with adding inputs together in a loop, using 0 as a sentinel value, and how I might be able to edit my previous program to answer the following question:

  1. Write a program that will allow the user to enter the prices of a number of items being purchased. The program should then calculate the subtotal for the sale, the tax on the sale (6%), and the total for the sale. Use 0 as a terminal value.

from decimal import *

rounding=ROUND_UP

itemPrice = float(input("Please enter item price: $"))

itemPrice = round(itemPrice, 2)

salesTax = itemPrice * .06

salesTax = round(salesTax, 2)

totalPrice = itemPrice + salesTax

totalPrice = round(totalPrice, 2)

print("Sales Tax: $" + str(salesTax))

print("Total Price: $" + str(totalPrice))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions