4. Операторы.

Арифметические

Сравнение

Логические

and

or

Бинарные

Условные

# conditions
a = 3
if a > 2:
    print "a > 2"

if a > 3:
    print "a > 3"
elif a < 1:
    print "a < 1"
else:
    print "1 <= a <= 3"

s = "abcdefgh"
is_looks_like_alphabet = s.startswith("abc") or s.endswith("xyz")
if is_looks_like_alphabet:
    print "Hmm, is it an alphabet?"
a > 2
1 <= a <= 3
Hmm, is it an alphabet?

Циклы

Особые