Class 26 — October 23
What’s its function
Another haiku — Is needed for today’ class — Am I up for it
Look both ways
Agenda
- Problem solve
- Problem solving strategies
- Introduce pair-programming
Paired programming
- Introductory video
Top-down design and bottom-up implementation
- When confronted with a big problem try to decompose it into subproblems. If they are still big, repeat the process. Afterwards solve the smallest problems first and use them to help solve the bigger problems.
Una problème de la journée
- Module polyglot.py
- Provides support for multi-line text translation using the Babel translation dictionary
- Tester — program use_polyglot.py
- Gets user text needing translation
- Tester — program cauldron.py
- Gets URL text needing translation
Example
- Module take_two.py defines two functions
- Function
signum( x )
- Function parameter
x
is a numeric value. The function returns integer -1, 0, or 1 depending respectively whetherx
is negative, zero, or positive. The function does not print any output.
- Function
mid( s )
- If the length of string
s
is odd, the function returns the middle character ofs
; otherwise, the function returns the two middle characters ofs.
The function does not print any output.
To do
- Look over artifacts