added new python programs with solutions for the ideas listed on the wordplay page
[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
8 for word in scrabble.wordlist:
9     score = 0
10     for char in word:
11         score = score + scrabble.scores[char]
12     if score > max_score:
13         max_word = word
14         max_score = score
15
16 print(str(max_score) + " : " + max_word)

Benjamin Mako Hill || Want to submit a patch?