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) // 3If 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?
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:
Look at code:
... do stego?
Please answer these three questions about what you learned in this class this semester. (No names, please.)
... 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.
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.