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:
andor:
ornot:
not
Identity:
x is yTrue if same objectx is not yTrue if not the same object
Membership:
x in yTrue if x member of collection yx not in y