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
brilliants [131]
4 years ago
12

Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl

e conditional.
Computers and Technology
1 answer:
victus00 [196]4 years ago
3 0

Answer:

following are the program to the given question:

Program:

x = 0#defining an integer variable that holds a value

if x < 0:#defining if that checks x less than 0

   print("This number ",  x, " is negative.")#print value with the message

else:#defining else block

   if x > 0:#defining if that checks x value greater than 0

       print(x, " is positive")#print value with message

   else:#defining else block

       print(x, " is 0")#print value with message

if x < 0:#defining another if that checks x less than 0

   print("This number ",  x, " is negative.")

elif (x > 0):#defining elif block that check x value greater than 0

   print(x, " is positive")#print value with message

else:#defining else block

   print(x, " is 0")#print value with message

Output:

Please find the attachment file.

Explanation:

In this code, an x variable is defined which holds a value that is "0", in the next step nested conditional statement has used that checks the x variable value and uses the print method that compares the value and prints its value with the message.

In another conditional statement, it uses if that checks x value less than 0 and print value with the negative message.

In the elif block, it checks x value that is greater than 0 and prints the value with the positive message, and in the else block it will print the message that is 0.

You might be interested in
WAP to input the rating of a movie, and print as per the given criteria:
vodka [1.7K]

Answer:

What is the question?

Explanation:

8 0
2 years ago
Write a program to input the TotalCost and display the Assured gift as per the following criteria TotalCost(TC) Assured Gift Les
Yanka [14]

Answer:

The program in Python is as follows:

TotalCost = int(input("Total cost: "))

if TotalCost <= 2000:

   print("Wall Clock")

elif TotalCost >= 2001 and TotalCost <= 5000:

   print("School Bag")

elif TotalCost >= 5001 and TotalCost <= 10000:

   print("Electric Iron")

else:

   print("Wrist Watch")

Explanation:

This gets input for total cost

TotalCost = int(input("Total cost: "))

If the total cost is up to 2000, print wall clock as the assured gift

<em>if TotalCost <= 2000:</em>

<em>    print("Wall Clock")</em>

If the total cost is between 2001 and 5000 (inclusive), print school bag as the assured gift

<em>elif TotalCost >= 2001 and TotalCost <= 5000:</em>

<em>    print("School Bag")</em>

If the total cost is between 5001 and 10000 (inclusive), print electric iron as the assured gift

<em>elif TotalCost >= 5001 and TotalCost <= 10000:</em>

<em>    print("Electric Iron")</em>

If the total cost is more than 10000, print wrist watch as the assured gift

else:

   print("Wrist Watch")

8 0
3 years ago
When you hear the word "automation" what comes to mind?
zloy xaker [14]

Answer:

The act of operation without direct control by a person.

Explanation:

The encyclopedia describes automation as “the procedure of producing an equipment, a method, or an arrangement function automatically.” We describe automation as "the formulation and utilization of technology to observe and regulate the reproduction and distribution of products and assistance.” to the society.

4 0
3 years ago
Which term was used to define the era of the Internet, when the web became a "platform" for user-generated input, as opposed to
Pachacha [2.7K]

Hello, The answer to your question is:-

<em><u>Option </u></em><em><u>"</u></em><em><u>Web </u></em><em><u>2</u></em><em><u>.</u></em><em><u>0</u></em><em><u>"</u></em>

<em><u>Reference and proof</u></em>:-

Web 2.0 refers to websites that emphasize <u>user-generated content</u>, ease of use, participatory culture and interoperability (i.e., compatible with other products, systems, and devices) for end users.

Hope it helps you...

Answered by Benjemin ☺️

✅

5 0
3 years ago
Write a method manyStrings that takes an ArrayList of Strings and an integer n as parameters and that replaces every String in t
raketka [301]

Answer:

public static ArrayList manyStrings(ArrayList<String> list, int n){

    ArrayList<String> newList = new ArrayList<String>();

    for (int i=0; i<list.size(); i++) {

        for (int j=0; j<n; j++) {

            newList.add(list.get(i));

        }

    }

    return newList;

}

Explanation:

Create a method called manyStrings that takes two parameters, list and n

Create a new ArrayList that will hold new values

Create a nested for loop. The outer loop iterates through the list. The inner loop adds the elements, n of this element, to the newList.

When the loops are done, return the newList

3 0
3 years ago
Other questions:
  • An electronic resume is a plain-looking document. True of False?
    6·2 answers
  • To remove an embedded chart, you should _____ it and press the DELETE key.
    14·2 answers
  • You can advance slides during a slideshow by pressing the page down key
    7·1 answer
  • Consumers’ ability to ""time shift"" programs using DVRs and Internet video and other situations that lack simultaneity is an ex
    6·1 answer
  • 1. Which of the following is an example of music piracy? a
    10·1 answer
  • When using a public computer or network, you should always _______. A. install a firewall. B. run an anti-virus program beforeha
    11·2 answers
  • Susan is a bookstore owner who maintains sales records in a spreadsheet. She wants to highlight the records that show sales in e
    14·1 answer
  • Addison, Inc. uses a perpetual inventory system. Below is information about one inventory item for the month of September. Use t
    15·1 answer
  • WAp to input the radius and print<br> the area of circle
    15·1 answer
  • which command entered without arguments is used to display a list of processes running in the urrent shell
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!