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
RUDIKE [14]
3 years ago
13

Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els

e, if givenYear is 2001 or greater (2001-2100), print "21st century". Else, if givenYear is 1901 or greater (1901-2000), print "20th century". Else (1900 or earlier), print "Long ago".
Computers and Technology
2 answers:
Komok [63]3 years ago
7 0

<em>year </em>= 2101

if <em>year </em>=> 2101 then

print ("Distant future");

else if <em>year </em>=> 2001 then

print ("21st Century");

else if <em>year </em>=> 1901 then

print ("20th Century");

else if <em>year </em><1901 then

print ("Long Ago");

<h2>Further Explanation </h2>

There are three types of conditionals in Python, which you can use to build a logic flow for your program. Python has the if, if..else, and if..elif..else statements.

To check conditions that do not meet the main conditions. Then else is used to handle all conditions other than the conditions that have been written.

If there are enough conditions to define, you can add other conditions by using the elif under the if statement and before the else statement.

And of course, a conditional can be stored in another if.

If Else condition

Decision making (if-else conditions) is not only used to determine what actions will be taken in accordance with the conditions but also is used to determine what actions will be taken/carried out if the conditions are not appropriate.

In python, there are several statements/conditions including if, else and elif The if the condition is used to execute code if the condition is true.

The condition if-else is a condition where if the statement is true True then the code in if will be executed, but if it is false False it will execute the code in else.

Learn More

if-else statement brainly.com/question/10798332

Conditional if in python brainly.com/question/10798332

Detail

Class: High School

Subject: Computers and Technology

Keyword: If-Else, Python, Code

RideAnS [48]3 years ago
3 0

#include <stdio.h>

int main(void) {

int givenYear;

givenYear = 1776;

if(givenYear >= 2100){

printf("Distant future");

}

else if (givenYear >= 2001){

printf("21st century");

}

else if (givenYear >= 1900){

printf("20th century");

}

else {

printf("Long ago");

}

return 0;

}

You might be interested in
1.1<br> What are three reasons why decision-making is required in a programmed work cyde?
fgiga [73]

Answer:

Programmed decisions are those that are repeated over time and for which an existing set of rules can be developed to guide the process. These decisions might simple, or they could be fairly complex, but the criteria that go into making the decision are all known or can at least be estimated with a reasonable degree of accuracy. For example, deciding how many raw materials to order should be a programmed decision based on anticipated production, existing stock, and anticipated length of time for the delivery of the final product. As another example, consider a retail store manager developing the weekly work schedule for part-time employees. The manager must consider how busy the store is likely to be, taking into account seasonal fluctuations in business. Then, she must consider the availability of the workers by taking into account requests for vacation and for other obligations that employees might have (such as school). Establishing the schedule might be complex, but it is still a programmed decision: it is made on a regular basis based on well-understood criteria, so structure can be applied to the process. For programmed decisions, managers often develop heuristics, or mental shortcuts, to help reach a decision. For example, the retail store manager may not know how busy the store will be the week of a big sale, but might routinely increase staff by 30% every time there is a big sale (because this has been fairly effective in the past). Heuristics are efficient—they save time for the decision maker by generating an adequate solution quickly. Heuristics don’t necessarily yield the optimal solution—deeper cognitive processing may be required for that. However, they generally yield a good solution. Heuristics are often used for programmed decisions, because experience in making the decision over and over helps the decision maker know what to expect and how to react. Programmed decision-making can also be taught fairly easily to another person. The rules and criteria, and how they relate to outcomes, can be clearly laid out so that a good decision can be reached by the new decision maker. Programmed decisions are also sometimes referred to as routine or low-involvement decisions because they don’t require in-depth mental processing to reach a decision. High- and low-involvement decisions are illustrated in.

5 0
3 years ago
Which of these is a way of making applications less vulnerable to hacking?
Alecsey [184]
(First one )
---------------------
7 0
3 years ago
Read 2 more answers
What port does the DarkComet malware listen on?
Agata [3.3K]
 Dark Comet will be listening on port1604
5 0
4 years ago
This common technique, employed at the edge of a network, eliminates the need for public IP addresses on a private network while
NNADVOKAT [17]

Answer:

NAT

Explanation:

Network Address Translation (NAT) allows nonroutable IP prefixes to hide behind a routable address.it translates IP addresses and ports of its internal hosts, hiding the true endpoint of an internal host on a private network.

Using NAT in this way allows network engineers to efficiently route internal network traffic to the same resources, and allow access to more ports, while restricting access at the firewall.

4 0
3 years ago
Antonio’s computer is hung up. which trio of keys should he press to restart his computer?
IgorLugansk [536]

Ctrl + Alt + Delete is the keys used by some PCs to reboot frozen computers by using task manager to kill any nonresponding applications. Another way to do this on some other is Ctrl + Shift + Esc.

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is a critique of the feature detector model of object recognition?​?
    8·1 answer
  • How are devices connected to each other via Bluetooth? Choose two answers.
    11·1 answer
  • How would a static local variable be useful?
    5·1 answer
  • How to find determinant of ​
    15·1 answer
  • Beverly is creating a website for her new clothing company. Aside from including photographs, how can she use the index page to
    8·2 answers
  • The continue statement _________.
    11·1 answer
  • What is the advantage of postfix notation?
    6·1 answer
  • Ask the user to input an integer. Print out the next three consecutive numbers.
    14·2 answers
  • What does a capitalist economy allow people to do?
    11·2 answers
  • Write an algorithm to sum all numbers between 0 and 1000 that are divisible by ,7​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!