INTERACTIVE ONLINE COURSE

Python 3

FOR BEGINNERS


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)


ALL REVIEWS
RESOLVED EXERCISIES
PAGE 1 / 6
The IF Conditional Statement
Home >>> Online Lessons, Python 3
REQUIREMENT

Two different integers are read from the keyboard. Display which one is greater.

SOLUTION

Analyze and run the program below:
Editor - if_ex1.py
       
Console / Output done
DETAILS

After reading the two numbers (variables n and m), the if statement is executed.

First, the logical expression is evaluated. In our example, it is n>m. If the number stored in variable n is greater than the one stored in variable m, the logical expression evaluates to True and n is greater than m is printed. Otherwise, the logical expression evaluates to False and m is greater than n is printed.

Since there are no more instructions after if, the program execution ends.
Analyze the solved problem,
then proceed to the next page.
 home   list  CONTENTS   perm_identity   arrow_upward