Skip to content

Commit e4a755d

Browse files
committed
outline
1 parent 6ae1ad2 commit e4a755d

3 files changed

Lines changed: 95 additions & 101 deletions

File tree

README.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,7 @@ This is a work in progress. If you see a directory contains a `README.md`, `solu
3030

3131
# Structure
3232

33-
Right now, I'm not sure how I'll structure the exercises. I wouldn't mind if you just randomly chose one and see how it goes. They vary quite a bit in difficulty, so maybe I'll just give them 1, 2, or 3 stars to indicate easy to hard. Here I'll give a brief overview of the exercises:
34-
35-
* abuse (\*\*): generate insults
36-
* anagram (\*\*\*): find anagrams of text
37-
* apples_and_bananas (\*): substitute vowels in text
38-
* bacronym (\*\*): back-fit words onto acronyms
39-
* blackjack (\*\*): play Blackjack (card game)
40-
* bottles_of_beer (\*): produce the "Bottle of Beer on the Wall" song
41-
* family_tree (\*\*): use GraphViz to visualize a family tree from text
42-
* gashlycrumb (\*): create a morbid lookup table from text
43-
* gematria (\*\*): calculate numeric values of words from characters
44-
* guess (\*): write a number-guessing game
45-
* hangman (\*\*\*): write a Hangman (word/letter-guessing game)
46-
* howler (\*): uppercase input text
47-
* jump_the_five (\*): numeric encryption
48-
* kentucky_fryer (\*\*): turn text into Southern American English
49-
* mad_libs: TBD
50-
* markov_words (\*\*): Markov chain to generate words
51-
* markov_chain (\*\*\*): Markov chain to generate text
52-
* morse (\*\*\*): write a Morse encoder/decoder
53-
* movie_reader (\*): print characters of text with movie pauses
54-
* palindromes (\*): find palindromes in text
55-
* picnic (\*): write the picnic game
56-
* piggie (\*\*): encode text in Pig Latin
57-
* ransom_note (\*): transform input text into RaNSom cASe.
58-
* rhymer (\*): produce rhyming "words" from input text
59-
* rock_paper_scissors (\*): write Rock, Paper, Scissors game
60-
* rot13 (\*\*\*): ROT13-encode input text
61-
* soundex-rhymer (\*\*): use Soundex to find rhyming words from a word list
62-
* substring (\*\*): write a game to guess words sharing a common substring
63-
* tictactoe (\*\*): write a Tic-Tac-Toe game
64-
* twelve_days_of_christmas (\*\*): produce the "12 Days of Christmas" song
65-
* war (\*\*): play the War card game
66-
67-
In addition, there are:
68-
69-
* appendix: texts on thing like data structures, regular expressions, etc. that are used in different exercises
70-
* bin: useful programs like `new.py`
33+
Right now, I'm not sure how I'll structure the exercises. I wouldn't mind if you just randomly chose one and see how it goes. They vary quite a bit in difficulty, so maybe I'll just give them 1, 2, or 3 stars to indicate easy to hard. See OUTLINE.md for more.
7134

7235
# Author
7336

family_tree/README.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,32 @@ Write a program called `tree.py` that will take an input file as a single positi
99
Use the `graphviz` module to generate a graph like the `kyc.gv.pdf` included here that was generated from the following input:
1010

1111
````
12-
$ cat kyc.txt
13-
EM = Ewell Magee
14-
MLB = Mary Lulu Bond
15-
EBM = Elizabeth Magee
16-
BJM = Jean Magee
17-
DWM = Durwood Magee
18-
MAM = Martha Magee
19-
EVM = Evelyn Magee
20-
EY = Ernest Youens
21-
MRY = Mrs. Youens
22-
BY = Bob Youens
23-
CY = Charlie Youens
24-
JY = John Youens
25-
KYC = Ken Youens-Clark
26-
NCY = Nancy Youens
12+
$ cat tudor.txt
13+
H7 = Henry VII
14+
EOY = Elizabeth of York
15+
H8 = Henry VIII
16+
COA = Catherine of Aragon
17+
AB = Anne Boleyn
18+
JS = Jane Seymour
19+
AOC = Anne of Cleves
20+
CH = Catherine Howard
21+
CP = Catherine Parr
22+
HDC = Henry, Duke of Cornwall
23+
M1 = Mary I
24+
E1 = Elizabeth I
25+
E6 = Edward VI
2726
28-
EM married MLB
29-
EM and MLB begat EBM, BJM, DWM, MAM, EVM
30-
MAM married CY
31-
CY and MAM begat KYC
32-
EY and MRY begat BY, CY, JY
33-
EY married MRY
34-
JY married NCY
27+
H7 married EOY
28+
H7 and EOY begat H8
29+
H8 married COA
30+
H8 married AB
31+
H8 married JS
32+
H8 married AOC
33+
H8 married CH
34+
H8 married CP
35+
H8 and COA begat HDC, M1
36+
H8 and AB begat E1
37+
H8 and JS begat E6
38+
$ ./tree.py tudor.txt
39+
Done, see output in "tudor.txt.gv".
3540
````

outline.md

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,67 @@
1-
# Playful Python
2-
3-
Learning Python by writing silly programs and games.
4-
5-
# Chapters
6-
7-
## Chapter 1: Bottles of Beer
8-
9-
## Howler
10-
11-
## Chapter 2: Palindromes
12-
13-
## War
14-
15-
## Blackjack
16-
17-
## Twelve Days of Christmas
18-
19-
## Tic-Tac-Toe
20-
21-
## Gematria
22-
23-
## Ransom Note
24-
25-
## Morse Encoder/Decoder
26-
27-
## ROT13
28-
29-
## Musical Transposition
30-
31-
## Hangman
32-
33-
## Gashlycrumb
34-
35-
## Movie Reader
36-
37-
## Substring
38-
39-
## Picnic
40-
41-
1+
# Playful Python Outline
2+
3+
I aim to have 40-50 programs complete with specs, examples, inputs, and test suites. They won't necessarily have a specific order, but they will be grouped into easiest/harder/hardest categories. As many programs use common ideas (e.g., regular expressions, graphs, infinite loops), there will be an appendix section with explanations of how to explore those ideas.
4+
5+
I have in mind a layout where each program gets four pages:
6+
7+
1 2 3 4
8+
+--------+--------+ +--------+--------+
9+
| | | | | |
10+
| | | | | |
11+
| | | | | |
12+
| illus/ | specs | |solution| notes |
13+
| info | | | | |
14+
| | | | | |
15+
| | | | | |
16+
+--------+--------+ +--------+--------+
17+
18+
1. If a short program, perhaps an illustration; if longer, maybe some background or hints.
19+
2. The `README.md` information (specs, example output)
20+
3. The `solution.py` contents
21+
4. Annotation of the solution with comments on lines, sections
22+
23+
# Programs
24+
25+
> "The only way to learn a new programming language is by writing programs in it." - Dennis Ritchie
26+
27+
The goal is to get the reader to become a *writer* -- to try to solve the problems. One technique in teaching is to first present a problem without showing how to solve it. Once the student engages with the problem, they find they want and need the object of the lesson. Each program is intended to flex some programming technique or idea like playing with lists or contemplating regular expressions or using dictionaries. By using `argparse` for the programs, we also cover validation of user input.
28+
29+
## Easiest
30+
31+
* **howler**: Uppercase input text so they YELL AT YOU LIKE "HOWLER" MESSAGES IN HARRY POTTER. (Could also be called "OWEN MEANY"?)
32+
* **jump_the_five**: Numeric encryption based on "The Wire."
33+
* **bottles_of_beer**: Produce the "Bottle of Beer on the Wall" song. Explores the basic idea of an algorithm and challenges the programmer to format strings.
34+
* **picnic**: Write the picnic game. Uses input, lists.
35+
* **apples_and_bananas**: Substitute vowels in text, e.g., "bananas" -> "bononos". While the concept is substitution of characters in a string which is actually trivial, it turns out there are many (at least 7) decent ways to accomplish this task!
36+
* **gashlycrumb**: Create a morbid lookup table from text. Naturual use of dictionaries.
37+
* **movie_reader**: Print text character-by-character with pauses like in the movies. How to read text by character, use STDOUT/flush, and pause the program.
38+
* **palindromes**: Find palindromes in text. Reading input, manipulation of strings.
39+
* **ransom_note**: Transform input text into "RaNSom cASe". Manipulation of text.
40+
* **rhymer**: Produce rhyming "words" from input text.
41+
* **rock_paper_scissors**: Write Rock, Paper, Scissors game. Infinite loops, dictionaries.
42+
43+
## Harder
44+
45+
* **abuse**: Generate insults from lists of adjectives and nouns. Use of randomness, sampling, and lists.
46+
* **bacronym**: Retrofit words onto acronyms. Use of randomness and dictionaries.
47+
* **blackjack**: Play Blackjack (card game). Use of randomness, combinations, dictionaries.
48+
* **family_tree**: Use GraphViz to visualize a family tree from text. Parsing text, creating graph structures, creating visual output.
49+
* **gematria**: Calculate numeric values of words from characters. Manipulation of text, use of higher-order functions.
50+
* **guess**: Write a number-guessing game. Use of randomness, validation/coercion of inputs, use of exceptions.
51+
* **kentucky_fryer**: Turn text into Southern American English. Parsing, manipulation of text.
52+
* **mad_libs**: TBD
53+
* **markov_words**: Markov chain to generate words. Use of n-grams/k-mers, graphs, randomness, logging.
54+
* **piggie**: Encode text in Pig Latin. Use of regular expressions, text manipulation.
55+
* **sound**: Use Soundex to find rhyming words from a word list.
56+
* **substring**: Write a game to guess words sharing a common substring. Dictionaries, k-mers/n-grams.
57+
* **tictactoe**: Write a Tic-Tac-Toe game. Randomness, state.
58+
* **twelve_days_of_christmas**: Produce the "12 Days of Christmas" song. Algorihtms, loops.
59+
* **war**: Play the War card game. Combinations, randomness.
60+
61+
## Hardest
62+
63+
* **anagram**: Find anagrams of text. Combinations, permutations, dictionaries.
64+
* **hangman**: Write a Hangman (word/letter-guessing game). Randomness, game state, infinite loops, user input, validation.
65+
* **markov_chain**: Markov chain to generate text. N-grams at word level, parsing text, list manipulations.
66+
* **morse**: Write a Morse encoder/decoder. Dictionaries, text manipulation.
67+
* **rot13**: ROT13-encode input text. Lists, encryption.

0 commit comments

Comments
 (0)