Scrabble challenge: Difference between revisions

Content added Content deleted
Line 89: Line 89:
====Step 3: find valid words====
====Step 3: find valid words====


Write the code to find all words from the word list that are made of letters that are a subset of the rack letters. There are many ways to do this, but here's one way that is easy to reason about and is fast enough for our purposes: go through every word in the word list, and for every letter in that word, see if that letter is contained in the rack. If it is, save the word in a <tt>valid_words</tt> list. Make sure you handle repeat letters: once a letter from the rack has been used, it can't be used again.
Write the code to find all words from the word list that are made of letters that are a subset of the rack letters. There are many ways to do this, but here's one way that is easy to reason about and is fast enough for our purposes: go through every word in the word lishe word in a <tt>valid_words</tt> list. Make sure you handle repeat letters: once a letter from the rack has been used, it can't be used again.


<b>Step 3 resources</b>:
<b>Step 3 resources</b>:
Line 100: Line 100:
</li>
</li>
</ul>
</ul>



====Step 4: scoring====
====Step 4: scoring====