projects
/
wordplay-cdsw-solutions
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
major updates to the solutions
[wordplay-cdsw-solutions]
/
solution_8_broken.py
diff --git
a/solution_8_broken.py
b/solution_8_broken.py
index 06beb89b378e8c5c487964b19f34ec1dc5616435..ca69baef4a9651dc11568a9b2ceda879a0862f27 100644
(file)
--- a/
solution_8_broken.py
+++ b/
solution_8_broken.py
@@
-1,22
+1,18
@@
import scrabble
import scrabble
-
-# See if you can tell the difference between this solution and the broken solution.
-
-
+# See if you can tell the difference between this solution and the working solution.
max_score = 0
max_word = ''
max_score = 0
max_word = ''
+
for word in scrabble.wordlist:
if word[0] == 'a' and word[3] == 'e' and len(word) <= 7 and len(word) >= 4:
for word in scrabble.wordlist:
if word[0] == 'a' and word[3] == 'e' and len(word) <= 7 and len(word) >= 4:
- score = 0
+
score = 0
for char in word:
score = score + scrabble.scores[char]
if score > max_score:
for char in word:
score = score + scrabble.scores[char]
if score > max_score:
- max_word = word
- max_score = score
-
-print max_score
-print max_word
+ max_word = word
+ max_score = score
+print(str(max_score) + " : " + max_word)
Benjamin Mako Hill
||
Want to submit a patch?