Class 9 – Monday, September 17
Like a moth to a flame
Look out my window – And see random acts of grace – By everyone
Look both ways
Agenda
- Introduce
for
loop
- Introduce lists
Example to motivate looping
- Program again_and_again.py
- Let's print out one-line-at-a-time, a bunch of the phrase Here I go again
Examples to introduce looping
- Program ready_or_not.py
- Prints out the integers 0 to
n-1
for user-suppliedn
; afterwards, prints out the phrase'Ready or not here I come!'
- Program thats_a_gauss.py
- Prints out total of integers 1 to
n
for user-suppliedn
.
Examples to introduce lists
- Program list_away.py
- Introduces list manipulation.
- Program in_summation.py
- Prints the total of a user-supplied list of numbers.
How one might generate a random digit
- A simplistic so-called black-box random-digit generator
To do list
- Review class artifacts.
- Read the epistle on lists.
- Check out my documentation for the
list
module.
- Check out my documentation for the
random
module.
© 2019 Jim Cohoon | Resources from previous semesters are available. |