Lecture 4: October 8, 2019
Reading
: §2.10, 4.4, 6.11
Due
: Homework 1, due on October 10 at 11:59pm
Greetings and felicitations!
Revision to homework 1, question 2; you can enter the sides one per line rather than all three on one line
Fibonacci numbers [
fib.py
]
Input
Output [
printing.py
]
Printing without format
Printing with format using
%
Printing with format using
format
method
Getting help in IDLE
continue
and
break
statements in loops [
loop1.py
]
import
statement
import math
[
hypotnoex1.py
]
Need the “math.” before “sqrt”
from math import sqrt
[
hypotnoex.py
]
Do not need the “math.” before “sqrt”
Now add in exception handling [
hypotex.py
]
Full version of the hypotenuse program [
pythag1.py
]
Functions [
hello.py
]
What functions are
Defining them
Using them
Quick look at using them [
quad.py
]
Passing values to functions
Returning values from functions
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.