9-7-23 Notes

What do programs do?

Data types Example Values
Integers 2 44 - 3
Floats 3.14 4.5 -2.0
Booleans True False
Strings "HEY" "a"

Expressions with operators can also be expressed with function call notation

from operator import add
a = 18 + 69
b = add(18 + 69) # these lines will have the same result

pow() is built-in

Anatomy of a Call Expression

add(18, 69)

How Python evaluates a call expression:

  1. Evaluate the operator
  2. Evaluate the operands
  3. Apply the operator (a function) to the operands

Names

If you do not put a return statement on your function, you will get None back.

Statements are different from expressions. A statement is executed by the interpreter to perform an action.