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
Describe what each of the following functions in R do.1. t2. matplot3. c4. seq5. legend6. matrix7. rownames8. colnames9. type of
slega [8]

Answer:

1. t is a function used to transpose a matrix object. The object is passed as an argument to the function.

2. matplot is a graphical function in R used for data visualization.

3. The c function is used to combine arguments.

4. seq is an R function used to derive a range of numbers, optionally specifying a start, stop and step argument or simply a single numeric argument.

5. legends are used in data visualization to list and define items in the graphical presentation.

6. matrix is a function in R used to create and work with matrix and data frame objects.

7. rownames and colnames are functions used to label the row and columns of a data frame in R.

8. The typeof function return the data type of an object.

Explanation:

The R programming language is a dedicated programming language for data analysis and visualization.

5 0
3 years ago
You can access various sites on the WWW by using hyperlinks or by
Vilka [71]
<span>or by following directions on screen </span>
5 0
3 years ago
What is the typical first shot that everyone takes? In photography
Firlakuza [10]

Answer:

the sky or of nature in general

Explanation:

7 0
3 years ago
If the VLOOKUP function is used to find an approximate match, what will it return if there is no exact match?
grigory [225]

Answer:

Its C

Explanation:

The largest value that is less then the lookup value

6 0
3 years ago
IANA has primarily been responsible with assigning address blocks to five regional internet registries (RIR). A tech needs to re
VikaD [51]

Answer:

The American Registry for Internet Numbers ARIN

Explanation:

The American Registry for Internet Numbers (ARIN) is a not for profit organization that serves as the administrator and distributor of Internet numeric resources such as IP addresses (IPv4 and IPv6) ASN for the United States, Canada, as well as North Atlantic and Caribbean islands

There are four other Regional Internet Registry including APNIC, RIPE NCC, LACNIC and AFRINIC.

6 0
3 years ago
Other questions:
  • The main thing that adjusting the aperture controls when taking an image is?
    15·1 answer
  • Will Give Brainliest!
    14·2 answers
  • Is this a Bad Cpu processor ? I need some.help ASAP I turn on my.pc and it has no display but everything is on fans and the you
    13·1 answer
  • Subscript numbering always starts at what value?
    14·1 answer
  • You are a domain administrator for a large domain. Recently, you have been asked to make changes to some of the permissions rela
    11·1 answer
  • You are a running cable in a new network. You are running a series of cables from the wiring closet to the RJ-45 ports for the c
    6·1 answer
  • In needs analysis: Group of answer choices the costs of different physical network design alternatives are assessed the rate of
    10·1 answer
  • at the grocery store alexa by 1 1/3 lb of ground turkey nasha by two times as much ground turkey is alexa how much ground turkey
    9·1 answer
  • What are the uses of computer in educational setting?
    5·2 answers
  • As you are discussing marketing with a client, you try to explain how individuals find sites. Which tool will you explain as the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!