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
Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is neede
Anastasy [175]

Answer:

Swap daemon

Explanation:

Swap daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is needed. The main function of the swap daemon is to monitor processes running on a computer to determine whether or not it requires to be swapped.

The physical memory of a computer system is known as random access memory (RAM).

A random access memory (RAM) can be defined as the internal hardware memory which allows data to be read and written (changed) in a computer.Basically, a random access memory (RAM) is used for temporarily storing data such as software programs, operating system (OS),machine code and working data (data in current use) so that they are easily and rapidly accessible to the central processing unit (CPU).

Additionally, RAM is a volatile memory because any data stored in it would be lost or erased once the computer is turned off. Thus, it can only retain data while the computer is turned on and as such is considered to be a short-term memory.

There are two (2) main types of random access memory (RAM) and these are;

1. Static Random Access Memory (SRAM).

2. Dynamic Random Access Memory (DRAM).

6 0
3 years ago
The recipient list cannot be edited.<br> Group of answer choices<br><br> True<br><br> False
Korvikt [17]

Answer:false                                becuse that what i got but i dont know though

5 0
3 years ago
How do different frequencies (color) of light affect a recorded video image?
Damm [24]

Answer:

How do different frequencies (colors) of light affect a recorded video image? It gives the recording a hue. It might also mess up the colors of the object on the set.

4 0
3 years ago
Write a program that multiplies two hard-coded numbers, then prints the individual numbers out and prints their product out, all
sp2606 [1]

Answer:

Written in Python:

num1 = 10

num2 = 15

print(num1)

print(num2)

print(num1 * num2)

Explanation:

The programs requires that two number be assumed and multiplied.

The program uses num1 and num2 to represent the two numbers (line 1 and line2)

These numbers were then initialized to 10 and 15, respectively (note that, you can replace these numbers with any number of your choice)

The next two lines then print num1 and num2

The last line prints the result of their multiplication

However, line by line explanation is as follows:

<em>This line initializes num1 to 10</em>

num1 = 10

<em>This line initializes num2 to 15</em>

num2 = 15

<em>This line prints num1</em>

print(num1)

<em>This line prints num2</em>

print(num2)

<em>This line prints the product of num1 and num2</em>

print(num1 * num2)

5 0
3 years ago
Write HTML code for inserting an image "cricket.jpeg" in size 500 width and 400 height.
Rainbow [258]

Answer:

<img src="cricket.jpeg" style="width: 500px; height:400px">

5 0
4 years ago
Other questions:
  • If you quote an author from a website in a paper, it will be important to create a _____ in your writing to give them credit for
    7·2 answers
  • What determines the choice of a rocket for a mission?
    11·1 answer
  • Analyze the following code:
    8·1 answer
  • Verify (valid or not valid) using resolution the following reasoning: "Every student in the SCIS is a CS student or an IT studen
    15·1 answer
  • What is the combination of the mechanical or digital process of film production and the illusion or illusions created in the min
    12·1 answer
  • Asymmetric key encryption combined with the information provided by a. certificate authority allows unique identification of the
    8·1 answer
  • Language/Type: Java ArrayList Collections
    6·1 answer
  • Write 5 things that can be done to avoid computer vision syndrome
    8·2 answers
  • What is DMTS. Explain it​
    10·2 answers
  • What is the full form of SAARC<br><br>And free point!! ​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!