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 a paragraph discuss 5 steps of saving a document in a storage device.<br>​
zubka84 [21]
<h2>The five steps of saving a document in a storage device are firstly, click File. Secondly, click Save As.</h2><h2> In addition, click Computer. Moreover, double click the storage device and type file name. Lastly, click Save or Enter.</h2>
6 0
2 years ago
How long does it take to design and program a character?
Kipish [7]
It takes about 5 days I believe 
6 0
3 years ago
What are 3 websites that talk about density of different gases, density in air, behavior of different gases of earth, convection
Tanzania [10]
I don’t know if this supports all, but try lenntech, duckters, and I will add on later
6 0
3 years ago
The difference between natural and technological system
kari74 [83]
Natural systems are systems that came into being by natural processes. Like the rain cycle.

Technological systems are those to whom people intervened or designed. Like diverting water for a rider for land irrigation.
5 0
3 years ago
Write at least 4 sentences
elixir [45]

Answer:

I don't know who advance the evolution who is it!

8 0
3 years ago
Other questions:
  • _____ is two or more connected computers.
    8·1 answer
  • What item on a business card is generally the most prominent?
    13·2 answers
  • What type of rain happens when cold air meets warm air
    14·1 answer
  • The CSS relative positioning property called ____ moves the element relative to its original position but preserves the space re
    9·1 answer
  • What are five most important areas of the animal industry that involve science and technology?
    14·1 answer
  • Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
    6·2 answers
  • Which are among the ways you can use bitlocker encryption? (choose all that apply?
    5·1 answer
  • Justin has started a lawn mowing business in his neighborhood. He is running a weed-pulling special this month. What is the most
    8·2 answers
  • Any material that comes into contact with the body must be __________.
    6·1 answer
  • The process of sending a result back to another part of the program is
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!