1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ICE Princess25 [194]
3 years ago
14

Write a program that uses a custom function to return the cost of purchasing an item, possibly in multiple quantities. The item

might be subject to 7% sales tax. The main function should prompt the user to enter the quantity, unit price, and taxable data. The main function should call the custom function with these three inputs as arguments and print the cost of the purchase in currency format.
Computers and Technology
1 answer:
alexandr402 [8]3 years ago
3 0

Answer:

def cost(quantity, unit_price, taxable):

   if taxable == "Yes":

       total = (quantity * unit_price) + (quantity * unit_price * 0.07)

   elif taxable == "No":

       total = quantity * unit_price

   return total

q = int(input("Enter the quantity: "))

p = float(input("Enter the unit price: "))

t = input("Is %7 tax applicable? (Yes/No): ")

print(str("$" + str(cost(q, p, t))))

Explanation:

- Create a function called cost that takes three parameters, quantity, unit price, and taxable

- If the tax is applicable, calculate the total with tax. Otherwise, do not add the tax.

- Return the total

- Ask the user for the inputs

- Call the function with given inputs and print the result

You might be interested in
Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
Sholpan [36]

Answer:

You can use JavaScript, HTML, PHP and so forth.

Explanation:

7 0
4 years ago
if ( (ans == 'Y' && errors < 5) || numTries < 10 ) // note uppercase 'Y' count++; Which combinations of values res
Shkiper50 [21]

The correction options to the case abode are:

Option B. ans = 'Y' (upper case)

errors = 6

numTries = 5

Option C. ans = 'y' (lower case)

errors = 4

numTries = 5

Option D. ans = 'Y' (upper case)

errors = 100

numTries = -1

<h3>What is Coding?</h3>

Computer coding is known to be the act that entails the use of computer programming languages to instruct the computers and machines on a given number of instructions on what need to be  performed.

Note that in the statement above,  the combinations of values results in count being incremented after the statement is complete is option B, C and D.

See full question below

Learn mode about coding from

brainly.com/question/22654163

#SPJ1

3 0
2 years ago
What is an effective technique for searching the web?
Arte-miy333 [17]
Google.com, Bing, or Dark Web engines.
7 0
4 years ago
3 ways to get home safe if there's drugs in your system
almond37 [142]
Dont drive so ask a friend to drive you home
3 0
3 years ago
Why might you insert a built-in text box from the tab instead of simply drawing a text box?
Tomtit [17]
It would look much neater
hope it helps
3 0
3 years ago
Read 2 more answers
Other questions:
  • A critical piece of equipment that provides power to systems even during a black out is called a(n) _______________.
    14·1 answer
  • Answer the following questions:
    7·1 answer
  • What finger is used to key letter c
    12·2 answers
  • web pages within the same website often have different blank because they have different blank A) home pages, urls B) goals, sou
    12·1 answer
  • "In a web app, where is data usually stored? A. Mobile network B. Application storage C. Local computer D. Cloud storage"
    14·1 answer
  • Define the four basic operation of a computer ​
    6·1 answer
  • Jenny, a programmer, uses Microsoft Excel 2016 to generate data required for the programs she develops. She uses various functio
    10·1 answer
  • When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
    8·1 answer
  • consider l= 5 ,r= 11. you must determine the sum of the values of the function in the range L to R . you have to calculate sum =
    7·1 answer
  • A trial-and-error method of problem solving used when an algorithmic or mathematical approach is called
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!