4. Conditionals¶
4.1 If¶
Syntax:
if True:
print('if true')
elif False:
print('elif true')
else:
print('neither true')
4.2 Conditional operators¶
Comparison:
Equal:
==
Not equal:
!=
Less than or equal:
<=
Greater than or equal:
>=
Logical:
and:
and
or:
or
not:
not
Identity:
x is y
True if same objectx is not y
True if not the same object
Membership:
x in y
True if x member of collection yx not in y