In Class: Week 2 (Numeric operators and the math library)
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:
% cd week02
% pwd
/home/your_user_name/cs21/class/week02
% cp ~newhall/public/cs21/week02/* .
% ls
We are going to do some of the following:
- Numeric Operators: 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...
- Accumulator Pattern: together we are going to write a program
that computes the average of 5 integer values that are
entered by a user. Let's open a new file in vim called ave.py.
- Try out the math library: open test_math.py in vim. In
another window lets run python interactively and take a look
at the functions available from the math library:
$ python
>>> import math
>>> help (math)
Now, lets try some out in test_math.py.