Answered step by step
Verified Expert Solution
Link Copied!

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 8% 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
add_tax python function Function takes a price and a boolean value indicating whether to add 8% 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 add_tax(price, add_tax_or_not):
price =340
add_tax = False
if add_tax
price = price *.8

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

The Question is in the attached image.

Answered: 1 week ago