In Class: Week 2 Wednesday and Friday
If you have not already done so, create a week02 subdirectory in your
cs21/class directory:
$ cd
$ cd cs21/class
$ pwd
/home/your_user_name/cs21/class
$ mkdir week02
Then, from within your week02 subdirectory copy over some python files
from my public directory (there are two new files that was not available
on Monday, so copy over all and you can say yes or no to replacing
any you alread have):
$ cd week02
$ pwd
/home/your_user_name/cs21/class/week02
$ cp ~newhall/public/cs21/week02/* .
$ ls
expr.py format.py test_math.py test_string.py
We are going to do some of the following:
- open expr.py in vim. It contains some examples of
numeric expressions and order of evalution. Let's take a look
at some of them...
- open test_math.py in vim. We will try out functions from
math library.
- open test_string.py. Together we will try writing some code using
string operators (concatenation (+), repetition (*), split ([pos1:pos2])
- next in the test_string.py file, we are going to try out some string
library functions. First we need to add this line to the top of the file:
from string import *
- open format.py in vim. It contains some examples of formated
output. Try running it in another terminal window and see if you
understand what is getting printed out.