15 February 2022

Python Boss Statements

All statements are complete imperative sentences.
All are worker statments

x = 5   Make x point at 5.
print("cows")   put "cows" to stdout.

Statement run in seriatum.

Desiderata:
    can we select code to run based on program state?
    can we run a chunk of code repeatedly?
    can we remember a procedure under a name?
    These alter the flow of execution.

Introducing the boss statement
Boss statmentts are grammmatially incomplete
    need a "block" to complet them

def "to define"


Mathematical function
3 parts

A set D, the domain, of all allowable inputs
A set R, the codomain, of all allowable outputs
A rule f tying each element x ∈ D to some f(x) ∈ R.

Mathematical functions are consistent: the same input
yields teh same output every time.

len's domain: sequencs and dictionaaries
len's codomain:  integers
len's rule: number of items in the collection