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
kati45 [8]
3 years ago
8

Write out code for a nested if statement that allows a user to enter in a product name, store the product into a variable called

product_name and checks to see if that product exists in your nested if statement. You must include 5 product names to search for. If it is then assign the price of the item to a variable called amount and then print the product name and the cost of the product to the console. If it does not find any of the items in the nested if statement, then print that item cannot be found.
Computers and Technology
1 answer:
OlgaM077 [116]3 years ago
6 0

Answer:

product_name = input("Enter product name : ")

if product_name=="pen"or"book"or"box"or"pencil"or"eraser":

   if product_name == "pen":  

       amount = 10

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "book":

       amount = 100

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "box":  

       amount = 150

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "pencil":  

       amount = 5

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "eraser":

       amount = 8

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

else:  

   print("Item not found!")

Explanation:

The python program is a code of nested if-statements that compares the input string to five items of the first if-statement. For every item found, its code block is executed.

You might be interested in
In cell h15 enter a vlookup function to determine the 2018 percentage of total attendance for the city listed in cell h14. Use t
Amanda [17]

Answer:

=vlookup(h14, a5:h11,8,false)

Explanation:

Here, h15 is the cell in which we need the output and the value to be matched in rows to find the exact row is h14, and the range is expressed as a5:h11. Now to find the column number, we need to figure out the first and the concerned column. So, the concerned column is in which the total attendance is being listed and it is h(h14), and the first column is a. So, the column number is a=1 h=8, =8. And since we need the exact match, the value of the fourth argument is false. And thus, we have the above formula. Remember. vlookup formula is:

=vlookup(cell where the result is to be placed, range, column number in the same row as h14, exact match or approximate match). For exact match it's false, and for the approximate match, it's true.

8 0
3 years ago
Which of the following terms are aspect ratios for devices? 'select all that apply
Viktor [21]

Answer:

1080 x 1920

800 x 600

Explanation:

These are the screen sizes that you can find in the list of the screen sizes, which can be easily found in the document that lists all the screen sizes. You will certainly find the 1080 x 1920 and also the 800 x 600, however, you will not find the 320 x 240 and 800 x 600. The last two are the standard screen sizes and hence are not the correct options. The correct options are as listed above.

3 0
3 years ago
Which of the following would be least effective?
Goryan [66]

Answer:

Exponential

Explanation:

The growth of an exponential function will develop much faster than all other functions included in the options meaning the execution time will take longer. This makes exponential functions the least efficient.

4 0
3 years ago
I watched an ad but the im button done is no where in sight, has anyone else experienced this recently. it was fine a few days a
Maurinko [17]

Answer:

This is usually just a small glitch that happens sometimes when you are seeing an ad and wanting to skip. Simple fixes to this problem include refreshing the browser or closing the application that you are in. This also would happen to me but following this fix should help with the problem.

7 0
2 years ago
PLEASE HELP 15 POINTS Emma plans on building a dog house using an algorithm. What will be the final step of the process? a) crea
cupoosta [38]

Answer:

Most likely C

Explanation:

Blueprint is the plan so she makes it 1st.

Building the roof is after the deck.

The deck is after the blueprint.

After it's all done she looks at it and thinks about what went wrong at then end.

If there are no mistakes it's B.

Hope this answers your question :).

6 0
3 years ago
Other questions:
  • What is the meaning for science?
    14·1 answer
  • A software programâs _________ indicates what can legally be done with that program.]
    5·1 answer
  • Which best describes a hybrid drive?
    11·1 answer
  • bro this scared me, i thought i just got hacked, could someone explain why when i went to ask a question, it kicked me out my ac
    9·2 answers
  • You have just finished installing a network adapter adapter and booted up the system, the drivers. You open File Explorer on a r
    13·1 answer
  • Someone please tell me please y my ps4 controller won’t charge:(
    12·2 answers
  • Create another method: getFactorial(int num) that calculates a Product of same numbers, that Sum does for summing them up. (1,2,
    7·1 answer
  • Why does the peot use a simular pharase at the beggining of each stanza
    8·1 answer
  • Var words = ["apple", "bug","car", "dream", "ear", "food"]
    6·2 answers
  • How can you distinguish between a manually added page break and an automatic page break in a worksheet?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!