Python Guide #6: Logical Conditions

Python supports usual mathematical conditions, they let you control the flow of the program.

Logical conditions return a bool, which has value of either True or False.

You can compare, using conditions, different types of data, not only numbers.


x == y

Not Equals

x != y

Greater than

x > y

Greater or Equal

x >= y

Less than

x < y

Less or equal

x <= y

Logical conditions are used in conditional statements, in loops and in if statements.

Next: Python Guide #7: If Statements

Previous: Python Guide #5: Numbers