4.1. Logic Bool

  • True - Positive value

  • False - Negative value

  • Builtin function bool() converts argument to bool

4.1.1. Syntax

  • First letter capitalized, other are lower cased

>>> data = True
>>> data = False
>>> data = true
Traceback (most recent call last):
NameError: name 'true' is not defined
>>> data = TRUE
Traceback (most recent call last):
NameError: name 'TRUE' is not defined

4.1.2. Type Conversion

  • Builtin function bool() converts argument to bool

>>> bool(True)
True
>>>
>>> bool(False)
False
>>> bool(1)
True
>>>
>>> bool(0)
False
>>>
>>> bool(-1)
True
>>> bool(1.0)
True
>>>
>>> bool(0.0)
False
>>>
>>> bool(-1.0)
True
>>> bool('hello')
True

4.1.3. Negative values

  • int() or 0 - zero integer

  • float() or 0.0 - zero float

  • bool() or False - false bool

  • str() or '' - empty str

  • tuple() or () - empty tuple

  • list() or [] - empty list

  • set() or set() - empty set

  • dict() or {} - empty dict

>>> bool(0)
False
>>>
>>> bool(0.0)
False
>>>
>>> bool(0+0j)
False
>>>
>>> bool(0.0+0.0j)
False
>>>
>>> bool(False)
False
>>>
>>> bool(None)
False
>>>
>>> bool('')
False
>>>
>>> bool(())
False
>>>
>>> bool([])
False
>>>
>>> bool({})
False
>>> bool(int())
False
>>>
>>> bool(float())
False
>>>
>>> bool(complex())
False
>>>
>>> bool(bool())
False
>>>
>>> bool(str())
False
>>>
>>> bool(tuple())
False
>>>
>>> bool(list())
False
>>>
>>> bool(dict())
False
>>>
>>> bool(set())
False

4.1.4. Comparison

  • x < y - Less than

  • x <= y - Less or equal

  • x > y - Greater than

  • x >= y - Greater or equal

  • == - Equals

  • != - Not Equals

>>> 10 < 2
False
>>>
>>> 10 <= 2
False
>>>
>>> 10 > 2
True
>>>
>>> 10 >= 2
True
>>>
>>> 10 == 2
False
>>>
>>> 10 != 2
True

4.1.5. Negation

  • not ... - negation

~1 -> 0
~0 -> 1
>>> not True
False
>>> not False
True

4.1.6. Conjunction

  • ... and ... - conjunction

Definition:

1 & 1 -> 1
1 & 0 -> 0
0 & 1 -> 0
0 & 0 -> 0

Example:

>>> True and True
True
>>>
>>> True and False
False
>>>
>>> False and True
False
>>>
>>> False and False
False

4.1.7. Disjunction

  • ... or ... - disjunction

Definition:

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

Example:

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

4.1.8. Boolean Algebra

  • and has higher precedence

  • or has lower precedence

  • use round brackets ( and ) to make code more readable

Example:

>>> True and True or False
True
>>>
>>> False and False or True
True
>>> (True and True) or False
True
>>>
>>> True and (True or False)
True
>>> True and False or False
False
>>>
>>> True and (False or False)
False

4.1.9. Use Case - 0x01

>>> username = 'mwatney'
>>>
>>> username == 'mwatney' or username == 'mlewis'
True

Why?

>>> username == 'mwatney'
True
>>>
>>> username == 'mlewis'
False

Therefore:

>>> True or False
True

4.1.10. Use Case - 0x02

>>> username = 'mwatney'
>>> password = 'Ares3'
>>>
>>>
>>> username == 'mwatney' and password == 'Ares3'
True

Why?

>>> username == 'mwatney'
True
>>>
>>> password == 'Ares3'
True

Therefore:

>>> True and True
True

4.1.11. Use Case - 0x03

>>> login = 'mwatney'
>>> password = 'Ares3'
>>>
>>> (login == 'mlewis' and password == 'Nasa1') or \
... (login == 'mwatney' and password == 'Ares3') or \
... (login == 'rmartinez' and password == 'Mav3')
True

Why?

>>> login == 'mlewis' and password == 'Nasa1'
False
>>>
>>> login == 'mwatney' and password == 'Ares3'
True
>>>
>>> login == 'rmartinez' and password == 'Mav3'
False

Therefore:

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

4.1.12. Assignments

"""
* Assignment: Type Bool Bool
* Type: class assignment
* Complexity: easy
* Lines of code: 3 lines
* Time: 2 min

English:
    1. Define variables:
        a. `result_a: bool` with result of `bool(True)`
        b. `result_b: bool` with result of `bool(False)`
        b. `result_c: bool` with result of `bool(None)`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_a: bool` z wynikiem `bool(True)`
        b. `result_b: bool` z wynikiem `bool(False)`
        b. `result_c: bool` z wynikiem `bool(None)`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> pprint(result_a)
    True
    >>> pprint(result_b)
    False
    >>> pprint(result_c)
    False
"""

# Result of `bool(True)`
# type: bool
result_a = ...

# Result of `bool(False)`
# type: bool
result_b = ...

# Result of `bool(None)`
# type: bool
result_c = ...

"""
* Assignment: Type Bool Int
* Type: class assignment
* Complexity: easy
* Lines of code: 3 lines
* Time: 2 min

English:
    1. Define variables:
        a. `result_a: bool` with result of `bool(1)`
        b. `result_b: bool` with result of `bool(0)`
        c. `result_c: bool` with result of `bool(-1)`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_a: bool` z wynikiem `bool(1)`
        b. `result_b: bool` z wynikiem `bool(0)`
        c. `result_c: bool` with result of `bool(-1)`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> pprint(result_a)
    True
    >>> pprint(result_b)
    False
    >>> pprint(result_c)
    True
"""

# Result of `bool(1)`
# type: bool
result_a = ...

# Result of `bool(0)`
# type: bool
result_b = ...

# Result of `bool(-1)`
# type: bool
result_c = ...

"""
* Assignment: Type Bool Float
* Type: class assignment
* Complexity: easy
* Lines of code: 3 lines
* Time: 2 min

English:
    1. Define variables:
        a. `result_a: bool` with result of `bool(1.0)`
        b. `result_b: bool` with result of `bool(0.0)`
        c. `result_c: bool` with result of `bool(-1.0)`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_a: bool` z wynikiem `bool(1.0)`
        b. `result_b: bool` z wynikiem `bool(0.0)`
        c. `result_c: bool` with result of `bool(-1.0)`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> pprint(result_a)
    True
    >>> pprint(result_b)
    False
    >>> pprint(result_c)
    True
"""

# Result of `bool(1.0)`
# type: bool
result_a = ...

# Result of `bool(0.0)`
# type: bool
result_b = ...

# Result of `bool(-1.0)`
# type: bool
result_c = ...

"""
* Assignment: Type Bool Str
* Type: class assignment
* Complexity: easy
* Lines of code: 3 lines
* Time: 2 min

English:
    1. Define variables:
        a. `result_a: bool` with result of `bool('hello')`
        b. `result_b: bool` with result of `bool('')`
        c. `result_c: bool` with result of `bool(' ')`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_a: bool` z wynikiem `bool('hello')`
        b. `result_b: bool` z wynikiem `bool('')`
        c. `result_c: bool` with result of `bool(' ')`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> pprint(result_a)
    True
    >>> pprint(result_b)
    False
    >>> pprint(result_c)
    True
"""

# Result of `bool('hello')`
# type: bool
result_a = ...

# Result of `bool('')`
# type: bool
result_b = ...

# Result of `bool(' ')`
# type: bool
result_c = ...

"""
* Assignment: Type Bool StrTrueFalse
* Type: class assignment
* Complexity: easy
* Lines of code: 4 lines
* Time: 3 min

English:
    1. Define variables:
        a. `result_d: bool` with result of `bool('0')`
        b. `result_e: bool` with result of `bool('0.0')`
        c. `result_f: bool` with result of `bool('False')`
        d. `result_f: bool` with result of `bool('None')`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_d: bool` with result of `bool('0')`
        b. `result_e: bool` with result of `bool('0.0')`
        c. `result_f: bool` with result of `bool('False')`
        d. `result_f: bool` with result of `bool('None')`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> assert result_d is not Ellipsis, \
    'Assign your result to variable `result_d`'
    >>> assert type(result_d) is bool, \
    'Variable `result_d` has invalid type, should be bool'

    >>> pprint(result_a)
    True
    >>> pprint(result_b)
    True
    >>> pprint(result_c)
    True
    >>> pprint(result_d)
    True
"""

# Result of `bool('0')`
# type: bool
result_a = ...

# Result of `bool('0.0')`
# type: bool
result_b = ...

# Result of `bool('False')`
# type: bool
result_c = ...

# Result of `bool('None')`
# type: bool
result_d = ...

"""
* Assignment: Type Bool True or False
* Type: class assignment
* Complexity: easy
* Lines of code: 3 lines
* Time: 2 min

English:
    1. Define variables:
        a. `result_d: bool` with result of `bool(not True)`
        b. `result_e: bool` with result of `bool(not False)`
        c. `result_f: bool` with result of `bool(not None)`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Zdefiniuj zmienne:
        a. `result_d: bool` with result of `bool(not True)`
        b. `result_e: bool` with result of `bool(not False)`
        c. `result_f: bool` with result of `bool(not None)`
    2. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    3. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> assert result_c is not Ellipsis, \
    'Assign your result to variable `result_c`'
    >>> assert type(result_c) is bool, \
    'Variable `result_c` has invalid type, should be bool'

    >>> pprint(result_a)
    False
    >>> pprint(result_b)
    True
    >>> pprint(result_c)
    True
"""

# Result of `bool(not True)`
# type: bool
result_a = ...

# Result of `bool(not False)`
# type: bool
result_b = ...

# Result of bool(not None)
# type: bool
result_c = ...

"""
* Assignment: Type Bool Not
* Type: class assignment
* Complexity: easy
* Lines of code: 2 lines
* Time: 2 min

English:
    1. What should be substituted in expressions to get expected value?
    2. Define variables:
        a. `result_a: bool` with solution to expression `not ... == True`
        b. `result_b: bool` with solution to expression `not ... == False`
    3. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    4. Run doctests - all must succeed

Polish:
    1. Co należy podstawić w wyrażeniach aby otrzymać wartość oczekiwaną?
    2. Zdefiniuj zmienne:
        a. `result_a: bool` z odpowiedź do wyrażenia `not ... == True`
        b. `result_b: bool` z odpowiedź do wyrażenia `not ... == False`
    3. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    4. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> result = not result_a
    >>> pprint(result)
    True

    >>> result = not result_b
    >>> pprint(result)
    False
"""

# Solution to expression `not ... == True`
# type: bool
result_a = ...

# Solution to expression `not ... == False`
# type: bool
result_b = ...


"""
* Assignment: Type Bool Is
* Type: class assignment
* Complexity: easy
* Lines of code: 2 lines
* Time: 2 min

English:
    1. What should be substituted in expressions to get expected value?
    2. Define variables:
        a. `result_a: bool` with solution to expression `True is ... == True`
        b. `result_b: bool` with solution to expression `True is not ... == False`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Co należy podstawić w wyrażeniach aby otrzymać wartość oczekiwaną?
    2. Zdefiniuj zmienne:
        a. `result_a: bool` z odpowiedź do wyrażenia `True is ... == True`
        b. `result_b: bool` z odpowiedź do wyrażenia `True is not ... == False`
    3. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    4. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> result = True is result_a
    >>> pprint(result)
    True

    >>> result = True is not result_b
    >>> pprint(result)
    True
"""

# Solution to expression `True is ... == True`
# type: bool
result_a = ...

# Solution to expression `True is not ... == False`
# type: bool
result_b = ...

"""
* Assignment: Type Bool Or
* Type: class assignment
* Complexity: easy
* Lines of code: 2 lines
* Time: 2 min

English:
    1. What should be substituted in expressions to get expected value?
    2. Define variables:
        a. `result_a: bool` with solution to expression `True or ... == True`
        b. `result_b: bool` with solution to expression `True or ... == False`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Co należy podstawić w wyrażeniach aby otrzymać wartość oczekiwaną?
    2. Zdefiniuj zmienne:
        a. `result_a: bool` z odpowiedź do wyrażenia `True or ... == True`
        b. `result_b: bool` z odpowiedź do wyrażenia `True or ... == False`
    3. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    4. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> result = True or result_a
    >>> pprint(result)
    True

    >>> result = True or result_b
    >>> pprint(result)
    True
"""

# Solution to expression `True or ... == True`
# type: bool
result_a = ...

# Solution to expression `True or ... == False`
# type: bool
result_b = ...

"""
* Assignment: Type Bool And
* Type: class assignment
* Complexity: easy
* Lines of code: 2 lines
* Time: 2 min

English:
    1. What should be substituted in expressions to get expected value?
    2. Define variables:
        a. `result_a: bool` with solution to expression `True and ... == True`
        b. `result_b: bool` with solution to expression `True and ... == False`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Co należy podstawić w wyrażeniach aby otrzymać wartość oczekiwaną?
    2. Zdefiniuj zmienne:
        a. `result_a: bool` z odpowiedź do wyrażenia `True and ... == True`
        b. `result_b: bool` z odpowiedź do wyrażenia `True and ... == False`
    3. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    4. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> result = True and result_a
    >>> pprint(result)
    True

    >>> result = True and result_b
    >>> pprint(result)
    False
"""

# Solution to expression `True and ... == True`
# type: bool
result_a = ...

# Solution to expression `True and ... == False`
# type: bool
result_b = ...

"""
* Assignment: Type Bool Nested
* Type: class assignment
* Complexity: easy
* Lines of code: 2 lines
* Time: 2 min

English:
    1. What should be substituted in expressions to get expected value?
    2. Define variables:
        a. `result_a: bool` with solution to expression `bool(bool(...) == ...) == True`
        b. `result_b: bool` with solution to expression `bool(...) is not bool(False) == False`
    2. Non-functional requirements:
        a. do not evaluate expressions in REPL or script
        b. fill in what you think is the result
        c. in place of ellipsis (`...`) insert only `True` or `False`
        d. this assignment checks if you understand the bool type
    3. Run doctests - all must succeed

Polish:
    1. Co należy podstawić w wyrażeniach aby otrzymać wartość oczekiwaną?
    2. Zdefiniuj zmienne:
        a. `result_a: bool` z odpowiedź do wyrażenia `bool(bool(...) == ...) == True`
        b. `result_b: bool` z odpowiedź do wyrażenia `bool(...) is not bool(False) == False`
    3. Wymagania niefunkcjonalne:
        a. nie ewaluuj wyrażeń w REPL'u ani w skrypcie Python
        b. wpisz to co Ci sie wydaje, że jest wynikiem
        c. w miejsce trzech kropek (`...`) wstawiaj tylko `True` lub `False`
        d. zadanie sprawdza, czy rozumiesz typ bool
    4. Uruchom doctesty - wszystkie muszą się powieść

Tests:
    >>> import sys; sys.tracebacklimit = 0
    >>> from pprint import pprint

    >>> assert result_a is not Ellipsis, \
    'Assign your result to variable `result_a`'
    >>> assert type(result_a) is bool, \
    'Variable `result_a` has invalid type, should be bool'

    >>> assert result_b is not Ellipsis, \
    'Assign your result to variable `result_b`'
    >>> assert type(result_b) is bool, \
    'Variable `result_b` has invalid type, should be bool'

    >>> result = bool(bool(result_a) is result_a) == True
    >>> pprint(result)
    True

    >>> result = bool(result_b) is not bool(False) == False
    >>> pprint(result)
    False
"""

# Solution to expression `bool(bool(...) is ...) == True`
# type: bool
result_a = ...

# Solution to expression `bool(...) is not bool(False) == False`
# type: bool
result_b = ...