reworked these examples a bit based on feedback in class
[wordplay-cdsw-solutions] / solution_7.py
index b7f8dde6d7858d1e58d4c0782f067d0c031d0f05..7b89fa399ba88ed91a4ff5f471585c776d26f629 100644 (file)
@@ -1,20 +1,16 @@
 import scrabble
 
-
-# Find the most valuable word in the dictionary using a double-loop. 
-
+# Find the most valuable word in the dictionary using a double-loop.
 
 max_score = 0
 max_word = ''
+
 for word in scrabble.wordlist:
     score = 0
     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?