In Class: Week 5


Run update21 to create a week05 subdirectory and copy example programs to your cs21 class directories. From there, move to your week05 directory:

    $ update21
    $ cd
    $ cd cs21/class/week05
    $ pwd
        /home/your_user_name/cs21/class/week05
    $ ls
      biggest_circle.py  example_funcs.py  squares.py
      draw_shapes.py     functionWorksheet.py      squares_list.py
	

We are going to do some of the following together in class:
  1. 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.

  2. 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.

  3. 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.

  4. open biggest_circle.py. We are going to write some functions together.

  5. open draw_shapes.py. We are going to write some functions together.

  6. At home: look over functionWorksheet.py and be able to understand where each variable is in scope and trace the execution of the program and predict the output.