我对这个税率计划做了什么我写的是准确的我试图找出为什么当我运行它时2.5%没有出现在该计划上它显示为不同的百分比,所以这是我到目前为止所得到的
`
# Author :
# Purpose: The purpose of this program is to ask the user to enter the amount of a item purchase.
# The program should then compute the state and county sales tax. Assume the
# state sales tax is 5 percent and the county sales tax is 2.5 percent. The program
# should display the amount of the purchase, the state sales tax, the county
# sales tax, the total sales tax and the total of the sale (which is the sum of
# the amount of purchase plus the total sales tax)
# Use the value 0.05 and 0.025
# Display "Enter item_price Amount"
# Input item_price
# Display "state tax is 5%"
# Set state_tax= 0.05
# Display "county_tax is 2.5%"
# Set county_sales tax = 0.025
county_tax = 0.025
state_tax = 0.05
tax_rate= county_tax + state_tax
#Ask User to enter item price and store it in the item price varible
item_price = float(input("Please enter the price of your item"))
item_price =int(100* item_price)
total_price = item_price*(1 + tax_rate)
#Calculate item price at .05, .025, and .075 tax rate
print("Your Purchase Amount was ${:0.2f}".format(item_price/100))
print("Your County Tax Rate was {}%".format(int(county_tax * 1000 * 20/100)))
print("Your State Tax Rate was{}%".format(int(state_tax * 1000 * 20/100)))
print("Your Total Sales Cost is ${:0.2}".format(total_price/100))
print("Your Total Tax Rate was{}%".format(int(tax_rate * 1000 * 20/100)))
答案 0 :(得分:0)
问题在于,您将这些值乘以20/100
没有明显的原因,因此显示您的0.025,即2.5%* .2