61cb133795aefc14d9764896503dba58b817bba3
[wordplay-cdsw-solutions] / solution_7.py
1 import scrabble
2
3 # Find the most valuable word in the dictionary using a double-loop.
4
5 max_score = 0
6 max_word = ''
7 for word in scrabble.wordlist:
8     score = 0
9     for char in word:
10         score = score + scrabble.scores[char]
11     if score > max_score:
12         max_word = word
13         max_score = score
14
15 print max_score
16 print max_word

Benjamin Mako Hill || Want to submit a patch?