Outline for April 6, 2009
Reading: §2.4–2.5
- Variables
- What they are
- Names, identifiers
- Legal, illegal names
- Reserved words
- Expressions
- Operation, operand
- Operators +, −, *, /, %, **
- Name Errors
- Output: print statement
- Commas add space or suppress end of line
- Print with nothing after it prints a blank line
- Assignment
- Simple assignment: variable = expression
- Simultaneous assignment:
variableA, variableB = expressionA, expressionB;
example of use swap.py
- Input: input statement
- input(prompt) prints prompt, waits for user
- When user hits enter, it evaluates what user types and returns it