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
_____ refers to a group of characters, letters and numbers that share the same design. a Typeface b Color c Shape d Line
mixas84 [53]

Answer:

typeface

Explanation:

6 0
3 years ago
What message will scroll?
Tasya [4]
Yeah there no picture
6 0
3 years ago
Read 2 more answers
SELECT vendor_name, COUNT(*) AS number_of_invoices, MAX(invoice_total - payment_total - credit_total) AS balance_due FROM vendor
grigory [225]

Answer:

Option a is the correct answer for the above question.

Explanation:

  • The above question asked about the order of the result which is derived from the above query. The above query holds an order by clause in desc order which is used to produce the result in descending order.
  • The descending order result is produced on the behalf of balance_due attributes and the option a also states the same. Hence option a is correct while the other is not because:-
  • Other is not states that the result is produced on the behalf of descending order.
4 0
4 years ago
Read 2 more answers
Which of the following is NOT an option in the comments group
IgorLugansk [536]
I need the options to help you out, thanks. :)
4 0
3 years ago
What is the output of the program?
Sergio [31]

Answer:

the output of the above program is

2 3

3 5

8

Explanation:

It seems the program is trying to pair two numbers into one and leaving the unpaired number (in a case of odd number of numbers) as a separate output.

This is why numbers 2 and 3 form 23, numbers 3 and 5 form 35 and 8 is another output of the program.

5 0
3 years ago
Other questions:
  • A data dictionary is sometimes described as "the database designer's database" because it records the design decisions about tab
    15·1 answer
  • The component that allows you to make a paper-based copy of a body of text is the _____.
    12·1 answer
  • What is the total utilization of a circuit-switched network, accommodating five users with equal bandwidth share, and the follow
    5·1 answer
  • What’s the best description of an opportunity cost
    5·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later
    12·1 answer
  • LaToya is creating a program that will teach young children to type. What keyword should be used to create a loop that will prin
    9·1 answer
  • Write code that will copy the contents of the file into an array. You can assume that the file will only have 5 data values
    11·1 answer
  • Que elementos han impactado las computadoras en la sociedad?​
    12·2 answers
  • I'm pretty sure most of you know squid game, right? Well, are the actors really dying? or is it just CGI or effects? Because it'
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!