gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
Write a function called tax_cost that accepts one parameter which represents a dollar…
- User
Write a function called tax_cost that accepts one parameter which represents a dollar amount before tax. The function should return the total amount that will be charged, including the tax. You should assume a tax rate of 13%. Example: If the dollar amount before tax is 2.00, then the total amount returned will be 2.26
- Assistant
def tax_cost(amount): tax_rate = 0.13 total_cost = amount * (1 + tax_rate) return round(total_cost, 2)
example usage
print(tax_cost(2.00)) # output: 2.26