Outline for September 29, 2025

Reading: §1, 2
Assignments: Homework 1, due October 15, 2025

  1. About the class
    1. Instructor
    2. Class web site, handouts
    3. Canvas and submitting homework
    4. Homework, grading, and extra credit

  2. Python
    1. What is Python?
    2. Why Python for this class?
    3. Compilers, assemblers, interpreters

  3. Python, files and shells
    1. Python: programming language that you use to tell the computer what to do
    2. Shell: what you can type Python statements directly into, to see what they do
    3. IDLE: the program that interprets Python statements (executes the Python program)
    4. File: type Python statements into this, and then have IDLE execute those statements by running the program in the file
    5. Jupyter, Anaconda, and Spyder

  4. First program: hello, world [hello_world.py]

  5. How to write a program; example is making change [make_change.py]
    1. Goal and general algorithm idea
    2. Representing data and basic program structure
    3. Translating this into a programming-like language
    4. Translating that into Python
    5. Defensive programming and debugging

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

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

  8. Example
    1. Compute the hypotenuse of a right triangle [hypotnoex.py, hypotnoex1.py]
    2. Handle input problem [hypotex.py]

  9. Exception SyntaxError — Python parser encountered a malformed statement

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

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

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

  13. Type converter functions int, float, str

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

  15. 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

  16. 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
MHI 289I, Programming in Health Informatics
Version of September 29, 2025 at 11:17AM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh