## Session 30

### Opening Exercise

This is a quickie. I have a function called average that takes three number arguments and returns a single number:

```    def average(num_1, num_2, num_3):
return (num_1 + num_2 + num_3) // 3
```
If all three of the numbers are in the range(0, 256), then the return value is also in the range(0, 256).

Write another Python function f(num_1, num_2, num_3) that receives three numbers in the range(0, 256) and returns a single number in the range(0, 256). Be creative!

How creative were you?

### Fun with Images

Back in Session 1, I opened with a little story about steganography and later talked about how it related to computer science. Those stories dealt with representing images as big collections of numbers. However, we never programmed with images this semester. Let's do a little now, for a light end to the course.

Quick review:

• pixel = (red, green, blue)
• the values red, green, and blue are in range(0, 256)
• 0 = no light and 255 = all light
• when red == green == blue, we get a shade of gray

Look at code:

• Image module with a few methods
• key methods for today: getPixel() and setPixel()
• look at grayscale and other effects
• do "student's choice"?

... do stego?

### Quick Review

Please answer these three questions about what you learned in this class this semester. (No names, please.)

• the coolest or most interesting bit of Python
• the most important idea
• the hardest thing we studied

... take stock of the answers.

In the notes for Session 1, we see:

#### What is Computer Science?

What did my talk about camouflage have to do with computer science?

• a problem in the world
• representing the problem in data
• manipulating the data to solve a problem
• an effect of CS in the world

The big ideas: names and values, abstract data and function. Language. Breaking down problems.

Advice for future courses: Ask questions early. This is how your professors find out what is and isn't working. When they know that, they can make adjustments.

### Wrap Up

• Code -- today's code file

• Reading -- No more, no more. Review Chapters 1-7, minus sections we skipped, and the sections we covered in Chapters 8-9.

Prof. Diesburg gave this study guide to her students before their second lab exam. It has a few questions about the second hald of the course and a few sample problems to work on. Youy may find it useful while studying for the final exam.

• Homework -- Homework 12 is available and due Saturday.

• Final Exam -- is next Thursday, December 18, from 3:00 PM until 4:50 PM.

Eugene Wallingford ..... wallingf@cs.uni.edu ..... December 11, 2014