Scrabble challenge: Difference between revisions
Content added Content deleted
imported>Jesstess No edit summary |
imported>Jesstess |
||
Line 71: | Line 71: | ||
Write the code to get the Scrabble rack (the letters available to make words) from the command line argument passed to your script. For example if your script were called `scrabble_cheater.py`, if you ran <tt>python scrabble_cheater.py RSTLNEI</tt>, <tt>RSTLNEI</tt> would be the rack. |
Write the code to get the Scrabble rack (the letters available to make words) from the command line argument passed to your script. For example if your script were called `scrabble_cheater.py`, if you ran <tt>python scrabble_cheater.py RSTLNEI</tt>, <tt>RSTLNEI</tt> would be the rack. |
||
Handle the case where a user forgets to supply a rack; in this case, print an error message saying they need to supply some letters. Make sure you are consistent about capitalization: if your scores dictionary is lowercase, the letters supplied by the user need to be converted to lowercase at some point before you compare them. |
Handle the case where a user forgets to supply a rack; in this case, print an error message saying they need to supply some letters, and then exit. Make sure you are consistent about capitalization: if your scores dictionary is lowercase, the letters supplied by the user need to be converted to lowercase at some point before you compare them. |
||
<b>Step 2 resources</b>: |
<b>Step 2 resources</b>: |
||
Line 83: | Line 83: | ||
<li>Converting letters to lower case: http://docs.python.org/library/stdtypes.html#str.lower</li> |
<li>Converting letters to lower case: http://docs.python.org/library/stdtypes.html#str.lower</li> |
||
</ul> |
</ul> |
||
====Step 3: find valid words==== |
====Step 3: find valid words==== |