functions, nested loops, lists, strings, top-down design, (and maybe file I/O)
Setting up a subdirectory for week 7 in-class work
cd into your cs21/class/ subdirectory and create a new directory named 'week07',
then cd into that directory:
$ cd cs21/class # cd into your cs21/class subdirectory
$ pwd
/home/your_user_name/cs21/class
$ mkdir week07 # make a subdirectory named week07
$ cd week07 # cd into it
$ pwd
/home/your_user_name/cs21/class/week07
Now copy over all the files from my public/cs21/week07 directory into your
week07 directory (remember to add the dot as the destination of the cp command).
From your week07 directory:
$ cp ~newhall/public/cs21/week07/* .
$ ls
filetest.py functionWorksheet2.py partsmove.py stringOps.py
foo.txt listOps.py primefactor.py
Weekly In-class Examples
This week we are going to continue to write functions, draw the stack and
trace through function calls, write functions that take different types,
including strings, lists, and graphics objects, and possibly look at
file I/O.
We are going to do some of the following together in class:
- Go over functionWorksheet2.py from Thursday last week.
- Look at the partsmove.py program. See what it is doing,
and see where some functions could come in handy.
- Together, write a couple version of a function to find the
prime factors of a given number. primefactory.py.
- We are going learn about the Top-Down Design problem solving
strategy, and then use it to start solving and designing a solution
to a larger programming problem.
program.
If we have time, we will look at some examples of reading in values
from a file, and just as a reminder some examples of using lists and
strings, and some of their methods:
- filetest.py
- listOps.py, stringOps.py: some list and string examples. Examples
converting lists to strings and strings to lists. Some example methods
of str and list objects.