Outline for September 27, 2021

Reading: §1
Due: Homework 1, due October 6, 2021
Handout: “Table of Precedence and Associativity”

  1. Assignment [swap.py]
    1. Simple assignment: variable = expression
    2. Simultaneous assignment: variableA, variableB = expressionA, expressionB

  2. Exception NameError — local or global name is not found

  3. Example
    1. Compute the hypotenuse of a right triangle [hypotnoex.py]

  4. Exception SyntaxError — Python parser encountered a malformed statement

  5. Exception ZeroDivisionError — attempt to divide (or take the remainder of) something by 0 [divby0.py, divby0ex1.py]

  6. The difference between strings and integers [twoplustwo.py]
    1. Difference between ’2 + 2’, 2 + 2

  7. Exception TypeError — operation or function applied to operand of wrong type
    1. Typing letters when a number is expected [divby0ex2]

  8. Type converter functions int, float, str

  9. String operators
    1. Operator +: string concatenation
    2. Operator *: repetition

  10. Input [make_change.py]
    1. input(prompt) prints prompt, waits for user
    2. When user hits enter, it returns what was typed as a string

  11. Basic output [printend.py]
    1. print(a, b, ...)
    2. end=’XXX’


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 235A, Computer and Information Security
Version of September 26, 2021 at 11:46PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh