In Class: Week 5
Create a week05 subdirectory in your cs21/class directory.
Then, from within your week05 subdirectory copy over some python files
from my public directory:
$ cd
$ cd cs21/class
$ pwd
/home/your_user_name/cs21/class
$ % mkdir week05
$ cd week05
$ pwd
/home/your_user_name/cs21/class/week05
$ cp ~newhall/public/cs21/week05/* .
$ ls
biggest_circle.py example_funcs.py squares.py
draw_shapes.py factorial.py squares_list.py
We are going to do some of the following together in class:
- open example_funcs.py in vim. We will look over the code which contains
calls to four functions, each is an example of functions that do or do not
take input values and functions that do or do not return a value. Once
we think we understand what the program is doing, lets try running it.
- open factorial.py. We will look over the code together. This
is an example of a function that takes input (it has parameters and
the function call contains argument values for the parameters) and
an example of a function that returns a value to the caller.
- open squares.py. Together we are going to write
a function square_the_biggest that takes two input values and
returns the square of the larger of the two values. Let's make
sure to test it for different input values to be sure it is
correct.
- open squares_list.py. Together we are going to write
a different version of square_the_biggest. This version takes
a list of input values, and returns the square of the largest
value in the list.
- open biggest_circle.py. We are going to write some functions together.
- open draw_shapes.py. We are going to write some functions together.