projects
/
wordplay-cdsw-solutions
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reworked these examples a bit based on feedback in class
[wordplay-cdsw-solutions]
/
solution_5_easy.py
diff --git
a/solution_5_easy.py
b/solution_5_easy.py
index d34efdc085a6b5e12b02df5920f4b821d250808b..9dda191d5317c366be304fce82f71b344dc59c39 100644
(file)
--- a/
solution_5_easy.py
+++ b/
solution_5_easy.py
@@
-1,7
+1,6
@@
import scrabble
import scrabble
-
-# Print every other word that starts with 'a' and ends with 9
+# Print every other word that starts with 'a' and is more than 9 letters long.
# This is the most basic implementation: keep a boolean to track whether the word
# was printed.
# This is the most basic implementation: keep a boolean to track whether the word
# was printed.
@@
-10,8
+9,7
@@
should_i_print = True
for word in scrabble.wordlist:
if word[0] == 'a' and len(word) >= 9:
if should_i_print:
for word in scrabble.wordlist:
if word[0] == 'a' and len(word) >= 9:
if should_i_print:
- print
word
+ print
(word)
should_i_print = False
else:
should_i_print = True
should_i_print = False
else:
should_i_print = True
-
Benjamin Mako Hill
||
Want to submit a patch?