Class 27 — October 25
Staying functional
I’m making a list – I’m not gonna check it twice – To find out if nice
Look both ways
Update
- UVA CS departmental submission server is now up
Agenda
- Explore list manipulating methods
- Consider Python pass-by-value parameter implications (and some related implications)
Best in show
Module butter.py
- Defines three functions performing list manipulations.
- Function
duplicate( x )
- Returns a new list whose elements are copies of those in
x
.
- Function
is_inorder( x )
- Returns whether elements of
x
are in sorted order.
- Function
greater( x, k )
- Returns a new list whose elements are those in
x
whose values are greater thank
.
- Program bread.py performs simple testing of module
butter
.
Module clean.py
- Defines three functions for cleaning up strings.
- Function
lower( strings )
- Returns a new list whose elements are lower case versions of those in
strings
.
- Function
strip( strings )
- Returns a new list whose elements correspond to the elements in
strings
with leading and trailing extraneous characters (punctuation or whitespace) removed.
- Function
canonical( strings )
- Returns a new list whose elements are lower case versions of those in
strings
with leading and trailing extraneous characters removed.
- Program cleaning.py when augmented performs simple testing of module
clean
.
To do
- Look over artifacts