d34efdc085a6b5e12b02df5920f4b821d250808b
[wordplay-cdsw-solutions] / solution_5_easy.py
1 import scrabble
2
3
4 # Print every other word that starts with 'a' and ends with 9
5 # This is the most basic implementation: keep a boolean to track whether the word
6 # was printed.
7
8 should_i_print = True
9
10 for word in scrabble.wordlist:
11     if word[0] == 'a' and len(word) >= 9:
12         if should_i_print:
13             print word
14             should_i_print = False
15         else:
16             should_i_print = True
17             

Benjamin Mako Hill || Want to submit a patch?