Lecture 4: October 8, 2019

Reading: §2.10, 4.4, 6.11
Due: Homework 1, due on October 10 at 11:59pm


  1. Greetings and felicitations!
    1. Revision to homework 1, question 2; you can enter the sides one per line rather than all three on one line
  2. Fibonacci numbers [fib.py]
  3. Input
  4. Output [printing.py]
    1. Printing without format
    2. Printing with format using %
    3. Printing with format using format method
  5. Getting help in IDLE
  6. continue and break statements in loops [loop1.py]
  7. import statement
    1. import math [hypotnoex1.py]
    2. Need the “math.” before “sqrt”
    3. from math import sqrt [hypotnoex.py]
    4. Do not need the “math.” before “sqrt”
    5. Now add in exception handling [hypotex.py]
  8. Full version of the hypotenuse program [pythag1.py]
  9. Functions [hello.py]
    1. What functions are
    2. Defining them
    3. Using them
  10. Quick look at using them [quad.py]
    1. Passing values to functions
    2. Returning values from functions

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 October 7, 2019 at 11:39PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh