Outline for November 17, 2020

Reading: §3.7, 7.7
Due: Homework 4, due December 1, 2020


  1. Show how to write a program that extracts sequences of digits from a line

  2. Common exceptions
    1. ZeroDivisionError — attempt to divide (or take the remainder of) something by 0
    2. TypeError — operation or function applied to operand of wrong type
    3. SyntaxError — Python parser encountered a malformed statement
    4. NameError — local or global name is not found
    5. ValueError — built-in function or operation applied to operator with illegal value
    6. EOFError — input function encounters an end of file
    7. FileNotFoundError — file could not be found
    8. Keyboard Interrupt — user hit the interrupt key (usually control-C)

  3. Handling exceptions
    1. except [except0.py]
    2. except exceptcode [except1.py]
    3. else [except2.py]
    4. except exceptcode as msgvar [except3.py]


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
MHI 289I, Programming for Health Informatics
Version of November 17, 2020 at 10:38PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh