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
Take any software or Application that you have recently purchased, this can be a video game or any other application helping you
IgorC [24]

A good product should have copyright protection which prevents others from using the product without permission.

Some products specify the penalties which are given to a person who makes unauthorized copies of their product and this is done to clearly educate to avoid ignorance claims.

A good product should have clear lettering which are legible and can be easily read, and should also have reasonable copyright protection.

<h3>What is Copyright?</h3>

This refers to the licensing which is done for a product and is also legally backed which prevents a person from illegally using or redistributing the work of a creator without their explicit consent.

Read more about copyright infringement here:
brainly.com/question/1078532

8 0
2 years ago
What is the recommended procedure for disconnecting an external hard drive to avoid losing data?
Zina [86]

Answer:

Instruct the operating system to eject the drive before unplugging it.

Explanation:

3 0
3 years ago
What port number is the well-known port used by web servers to distribute web pages to web browsers?question 3 options:?
stira [4]
This is port 80 for clear-text connections and 443 for encrypted (TLS) connections.
5 0
3 years ago
Which of the following statements is the least abstraction of the world wide web
Sliva [168]
<span>Documents, images and other data you can access by providing a uniform Resource Locator. URL - the Web Address

I hope this helps. You didn't give me the choices to from.  </span>
8 0
3 years ago
Read 2 more answers
PGP encryption can be performed from the command line as well. What is the PGP command line syntax to encrypt the my-message.txt
Mrac [35]

Answer:

pgp --encrypt "my-message.txt" --recipient (Sean) --output ("secret-message.txt.gpg")

Explanation:

PGP encryption from the command line can be done using the following format:

  • pgp --encrypt (input) --recipient (user) --output (output file)

Therefore, PGP command line syntax to encrypt the my-message.txt file for a specific user (Sean) and save the output as secret-message.txt.gpg is:

  • pgp --encrypt "my-message.txt" --recipient (Sean) --output ("secret-message.txt.gpg")
6 0
3 years ago
Other questions:
  • What is the purpose of the “little down arrow” next to many different functions in word
    6·1 answer
  • in c Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the li
    14·1 answer
  • When studying an information system, illustrations of actual documents should be collected using a process called _____.
    12·1 answer
  • PLEASE HELP, True or False: The term whitespace speaks to the design of a website
    8·2 answers
  • What data discovery process, whereby objects are categorized into predetermined groups, is used in text mining?
    9·1 answer
  • Which of the following statements is not true? Question 16 options: a) SQL is the most popular query language used for interacti
    10·1 answer
  • If I use google incognito mode or a throwaway google account can my search history be tracked by Microsoft parental controls?
    7·1 answer
  • In 3-5 sentences describe to me in detail how you can make a change and better our online community. What are steps would you ta
    8·2 answers
  • How could the following line of code be shortened?
    11·1 answer
  • in the future, mobile technologies are expected to be used more than desktop computers today. what other improvements are helpin
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!