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
Help ASAP
Gelneren [198K]

Answer:

By supplying a variety of charts and graphs to present the information in best way.

By tracking and analyzing the data

By conveying large amount of numerical data in more understandable format.

Explanation:

You need to know the limitations of Excel software. You will find that it does not support more than 3 variables while analyzing. However, if you use analytic software like Tableau and Microsoft Power BI then you can use a lot number of variables. And this is done through graphs and charts, and the other variables apart from x, y, z are the colors, shades. etc. Even color alone can add a good number of variables, and hence you can understand. Thus, you will be able to query better. Queries become better if you have more variables. And charts and graphs always present the information in the best way/ Also you can track and analyze the data. And through it conveying a large amount of numerical data in a more understandable format is made possible, and this is definitely quite helpful. Hence, all of the options mentioned above are helpful. But they do not do complex calculations and complex queries in fact.

4 0
2 years ago
Read 2 more answers
Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolut
STALIN [3.7K]

Solution :

x = float_(input())

y = float_(input())

z = float_(input())

res1 = x**z

res2 = x**(y**z)

res3 = abs(x-y)

res4 = (x**z)**0.5

print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(res1,res2,res3,res4))

Output is :

5.0

1.5

3.2

172.47 361.66 3.50 13.13

6 0
2 years ago
What is Key benefit of using ram in a computer
deff fn [24]
There is not really a key benifit, but it does help with little things.
7 0
2 years ago
The AND operator is a disjunction and the OR operator is a conjunction.
qwelly [4]

Answer:

True but it might be false but i think is true

8 0
2 years ago
Mason is part of a project team that is creating a television advertisement. List one risk the team faces and a strategy for min
Andru [333]

One risk might be that they might use copyright music and and the music creator might take legal action.

5 0
3 years ago
Other questions:
  • Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1,
    11·1 answer
  • Write an application that asks a user to type an even number or the sentinel value 999 to stop. When the user types an even numb
    8·2 answers
  • Consider the clipping of a line segment in two dimensions against a rectangular clipping window. Show that you require only the
    10·1 answer
  • Which of the following is a rule of thumb for cell phones or smartphone etiquette ?
    12·1 answer
  • How neural networks impact our life??
    7·1 answer
  • Misperceptions can lead to miscommunication. List an example from the article.(site 1)
    10·2 answers
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
  • Preciso de ajudar para resolver esse exercício, é para amanhã cedo!!<br><br> Em Dev C++
    12·2 answers
  • What are the three main elements common to all radio ads?
    9·2 answers
  • what must you consider when determining the efficiency of an algorithm? select two choices. group of answer choices the amount o
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!