Module: (Python) Conditional statement


Problem

1/17

Largest of two numbers - OPTION 1

Theory Click to read/hide

Control Structures

Do you want to learn how to create powerful, "intelligent", versatile and useful programs?

Then you need to learn the three main forms of program execution control. According to the theory of computer systems, a good programming language should provide the implementation of three forms of control over the execution of programs.

1 - SEQUENCE:  execution of sequential statements - we have already met with this in earlier courses. All our previous programs are some sequence of statements.

2 - SELECT:
     if such and such a case,
              then do it
     otherwise do that.
3 - REPEAT:
UNTIL (as long as such and such cases — do it).

The second form – CHOICE between different ways of doing things makes programs more "intelligent" and also makes computers extremely efficient.

Let's start with a simple example. 
You must enter two real numbers from the keyboard and determine the largest of them.
Explore this example.

Problem

According to the condition of the problem, we need to display one of two answer options: if the first number is greater than the second, then display it on the screen, if there is no — then the second number
Let's consider the first solution to this problem: the result is immediately displayed on the screen.

1. Run the program for execution.
2. Analyze the input and output data.