Add a license.
[wordplay-cdsw-solutions] / solution_5_advanced.py
1 import scrabble
2
3
4 # This is a solution to 5 that reuses the code in 1. 
5 # Whenever we can, it's good to reuse code that we already have.
6 # Next Saturday, we'll talk about defining functions, which is the way programmers
7 # re-use code.
8
9 matching_words = []
10
11
12 for word in scrabble.wordlist:
13     if word[0] == 'a' and len(word) >= 9:
14         matching_words.append(word)
15
16
17 # Note that I use enumerate. You should look that up online to see what it does.
18 for i, word in enumerate(matching_words):
19     if i % 2 == 0:
20         print word
21             
22
23

Benjamin Mako Hill || Want to submit a patch?