72. & 73. & 74. Introduction / Aggregator / Coding

Associated Truth Values

— every object in Python has an associated truth value

— Except:

  1. None
  2. False
  3. Zero in any numeric type: (0, 0.0, 0+0j…)
  4. Empty sequences: list, tuple, string…
  5. Empty mapping type: dicts, set…
  6. Custom classes that implement a bool , len ; When python read the class if no bool then go to len and return truth value or false value as 0.

— Any methods return false or 0

Untitled

Predicate: A function that takes a single argument and return true or false is called a “Predicate”

Ex: Boolean

Untitled

Untitled

Coding