6.8. Boolean Disjunction

6.8.1. Rationale

1 | 1 -> 1
1 | 0 -> 1
0 | 1 -> 1
0 | 0 -> 0

6.8.2. Syntax

>>> True or True
True
>>> True or False
True
>>> False or True
True
>>> False or False
False

6.8.3. Example

>>> name = 'Mark Watney'
>>>
>>> name == 'Mark Watney' or name == 'Melissa Lewis'
True

Because:

>>> name = 'Mark Watney'
>>>
>>> name == 'Mark Watney'
True
>>> name == 'Melissa Lewis'
False

Rule:

>>> True or False
True

6.8.4. Control Flow

>>> name = 'Watney'
>>>
>>> if name == 'Watney' or name == 'Lewis':
...     print('Hello astronaut')
... else:
...     print('Sorry, astronauts only')
Hello astronaut

6.8.5. Assignments