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
Anastasy [175]
3 years ago
13

Python provides a special version of a decision structure known as the ________ statement, which makes the logic of the nested d

ecision structure simpler to write.
Computers and Technology
1 answer:
IrinaVladis [17]3 years ago
7 0

Answer:

if-elif-else                                            

Explanation:

In Python if condition is used to decide whether a statement or a block of statements is to be executed or not based on the condition, if the condition evaluates to true then the block of statements is executed and if the condition is false then it is not executed.

Sometimes we need to execute some other statement when the condition is false. For example

if (number1 <= number2)

print (number1,  "is the smallest")

Lets suppose we want to print another statement if this condition evaluates to false. If the condition gets false then the following message should be displayed:

print(number 2, "is the smallest")

For this purpose else statement is used along with if statement to execute the block of code when the if condition evaluates to false.

if (number1 <= number2)

print (number1,  "is the smallest")

else:

print(number 2, "is the smallest")

Now what if there are three numbers or more numbers to be compared in order to identify the smallest number from the given numbers. So in this case we have multiple options to be checked. else statement will not be enough a  for else there can be at most one statement. With if elif else multiple conditions can be checked and if any of the condition evaluates to true then its block of code is executed and if none of the condition is true then the last else statement will be executed.

For example:

if (number1 <= number2) and (number1 <= number3):

print (number1,  "is the smallest")

elif (number2 <= number1) and (number2 <= number3):

print (number1,  "is the smallest")

else:

print (number3,  "is the smallest")

In this example number1 is compared to number2 and number3. If both numbers are less than number1 then the program control goes to elif statement where number2 is compared to number1 and number3. if this condition is false too then the final else part will be printed which is that number3 is the smallest.

Take another example where there are more number of expressions to be checked.

val = 50

if (val == 40):  

   print ("value is 40")  

elif (val== 35):  

   print ("value is 35")  

elif (val == 25):  

   print ("value is 25")  

elif(val==15):

    print ("value is 15")  

else:  

   print ("value is not present")

This will output the else part value is not present, because none of the condition evaluates to true.

You might be interested in
Select all the correct answers. Which two statements are true about an OS? translates the user's instructions into binary to get
lubasha [3.4K]

Answer:

all

Explanation:

4 0
3 years ago
Which of the following is the term for a device (usually external to a computer) that is plugged into a computer's communication
Serjik [45]

A device, usually external to a computer that is plugged into a computer's communication port or is connected wirelessly. Common peripherals are keyboards, mice, monitors, speakers, and printers

4 0
3 years ago
100 Base-T: Group of answer choices
Allisa [31]

Answer:

can run at either full- or half-duplex

Explanation:

In Computer Networking, 100Base-T also known as fast ethernet is an ethernet standard that operates at 100Mbps and can run at either full- or half-duplex.

It uses Shielded Twisted Pair (STP) cabling system.

The Variations of 100BaseT are;

- 100BaseTX

- 100BaseFX.

8 0
3 years ago
The security administrator of ABC needs to permit Internet traffic in the host 10.0.0.2 and UDP traffic in the host 10.0.0.3. Al
koban [17]

Answer:

The correct selection is the letter C. The first ACL is denying all TCP traffic and the other ACLs are being ignored by the router.

Explanation:

In this case, the letter C is the right answer because with the first ACL exactly:

access-list 102 deny tcp any any

We are denying all traffic with the next line deny tcp any any, in this case, the others line are being ignored.

access-list 104 permit udp host 10.0.0.3 any

access-list 110 permit tcp host 10.0.0.2 eq www any

access-list 108 permit tcp any eq ftp any

For that nobody can access to the internet, the security administrator of ABC must change the first ACL.

5 0
3 years ago
Jose is upgrading the memory on his laptop. The laptop has two slots for RAM, but one of them is currently being occupied. He ha
inn [45]

Answer:

Reseat the new stick of RAM

Explanation:

Joe needs to reseat the new stick of the RAM. For that, he should gently release the clips which hold RAM in the correct posture, and one on each side. Joe is required to do this for each of the available memory modules. And then he will have the cautiously replace all the memory modules( 2 in number) through to DIMM slots which are on the motherboard. Make sure that you have noted down the locations of each notches on the RAM as well as the DIMM slots.

3 0
3 years ago
Other questions:
  • if the president goes for vice president after his 2 term and the present president dies is the old president the president agai
    8·2 answers
  • What component has the job of managing data as it flows into and out of the places it needs to go?
    11·2 answers
  • Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then
    15·1 answer
  • This is the thing that I don't understand why did they banned private chat like there are long-distance relationships, and frien
    13·2 answers
  • A keyboard and touch screen are the most common of ________ devices. select one:
    11·1 answer
  • Which institution developed outside the limits of the written costitution of the united states ?
    14·1 answer
  • How much time per day does the average U.S. youth spend watching television, playing video games, or using a computer?
    8·1 answer
  • Write an application that displays the strings in the provided array alphabetically in ascending order.
    9·1 answer
  • What is abbreviation of the computer​
    15·2 answers
  • a blank search examines the first item to see if it is a match, then the second, and so on. answers: linear, binary, and orderly
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!