Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Steve is attempting to write a function that takes a price and a boolean value indicating whether to add tax. The value of the boolean
Steve is attempting to write a function that takes a price and a boolean value indicating whether to add tax. The value of the boolean will determine whether or not you add a tax to the price. If the boolean value is true, we will add an tax to price and then return the total. If the boolean value is false, we will just return the price.
The function that Steve has written has some errors. Fix the errors in order to ensure that the function is doing what the question is asking for.
Name Type Description
addtax python function Function takes a price and a boolean value indicating whether to add tax to the price. Depending on the boolean value, the function will return the price with the tax added on top or just the price.
def addtaxprice addtaxornot:
price
addtax False
if addtax
price price
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started