Conditional if construct. Python: the vastness and simplicity of a language

The simplicity of Python allows beginners to learn a programming language. The presence of various methods, functions, libraries, constructs and cycles allows you to solve even the most complex problems. For example, the conditional operator if. Python offers simple, intuitive, and widely used construction syntax.

if python




Python Overview

Using Python, tasks can be completely different. Why?

  • Interpretability of the language. This means that the source code is not compiled into machine record, but is executed by the interpreter.
  • Interactivity It turns out that the program implements the commands written in the shell of the interpreter after executing the previous ones.
  • Object Orientation The language perfectly supports the principles of OOP. It is understood that the program code encapsulates commands in objects, or otherwise called special structures.

Python , . , , , , .

2013 Python . Java, – ++. 2017 . Java, – ++, – Python. , . . Python – , .





Python

, .

  • help () , .
  • Python , ( web- ).
  • - : Windows, Linux, Mac Os.
  • . «» , web-, ..
  • , Python, .
  • , "", , ++, .
  • Python, .
  • . .

if (Python ) . True, . . .





if Python :

  • if. . , . – False, .

- if.

python methods




:

python methods




  • if …else. else. , , . , False.

- if ...else.

python tasks




:

python tasks




  • if… elif… else. , , . - True, . elif , else.

- if ...elif ... else.

python in russian




:

python in russian




The if construct (Python 3.0 and 2.7 agree on this) allows the use of checking one condition inside another. This means that when setting up a truth check, it may be necessary to iterate over several more Boolean expressions. In this case, another one is embedded in the if construct (for example, if ... elif .... else). The user needs to carefully indent as Python does not tolerate liberties in this regard.




All Articles