In Class: Week 7 Tuesday


Run update21 to download week07 files

    $ cd
    $ update21
    $ cd cs21/class/week07/
    $ ls
	

Topics

In Class Work

We are going to do some of the following together in class. After class, you can obtain today's solutions by running update21 again. Solutions will have the prefix _soln.py.
  1. strings and lists as objects:

    On the class schedule for week6 is a link to information about using strings and lists as objects, and about using the random library.

    We have talked about lists and strings as being objects and how to see a listing of the methods each provide. In the python interpreter, you can get information about list and str class method functions by calling help(class_name):

      $ python
      >>>  help(str)
      >>>  help(list)
    	

    The files listOps.py and stringOps.py from week06 show some examples of using list and string method functions.

  2. open printName.py in vim. We are going to manipulate a string using methods from the string class. Note the use of dot notation to invoke functions on the object itself.
  3. open up format.py in vim. We have already gone through examples of string formatting on the board and in using the python interpretor. These are more examples, you should be run the program and be able to identify the different components of the string formatting commands.