Syntax

English example: "good morning hello you" is not syntactically valid. "good morning to you" is syntactically valid".

Programming language example: "hello"3 is not syntactically valid. 2*3 is syntactically valid.

Semantics

The meaning of the program. What is supposed to happen when the program executes.

Objects

Expressions

Combine objects and operators to form expressions:

Operators on ints and floats

Parentheses are used to tell Python to do these operations first. operator precedence without parentheses:
  1. **
  2. *
  3. /
  4. + and - executed left to write, as appear in expression.

Equal sign is an assignment of a value to a variable

pi = 3.14159
Value is stored in computer memory. An assignment binds name to value. Retrive value associated with name or variable by invoking the name, by typing pi.

Abstracting expressions: give names to values of expressions, to reuse names instead of values. Example:

pi = 3.14159
radius = 2.2
area = pi * (radius ** 2)

Programming vs. Math: In programming, you do not "solve for x"

pi = 3.14159
radius = 2.2
# area of circle
area = pi*(radius**2)
radius = radius + 1
Notice that in an assignment, the expression on the right is evaluated to a value, and a variable name is on the left. radius += 1 is equivalent to radius = radius + 1.

Changing bindings: can re-bind variable names using new assignment statements. Previous value may still be stored in memory but lost the handle for it. e.g., radius -> 2.2 now becomes radius -> 3.2.