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

Benjamin Mako Hill || Want to submit a patch?