Propositional Logic · Propositions
Lesson 4
Remembering that such expressions have Boolean type is useful for simplifying code and improving its readability. For example, instead of
if x > 17:
return True
else:
return Falseuse
return x > 17whereas instead of
if x > 17:
return True
else:
if z > 3:
return False
else:
return Trueuse
return x > 17 or z <= 3