Anonymous user
Skillshare intro to Python/Unit 5: Difference between revisions
→Checking your work
imported>Jesstess No edit summary |
imported>Jesstess |
||
(8 intermediate revisions by the same user not shown) | |||
Line 20:
<pre>
$ python scrabble.py ZAEFIEE
16 faze▼
15 fiz▼
15 fez▼
12 zee▼
12 zea▼
11 za▼
6
6
6
▲5 if
▲5 fe
▲5 fa
▲5 ef
▲2 ee
▲2 ea
17 FEAZE
▲2 ai
17 FEEZE
▲2 ae
</pre>
Line 56:
==Breaking down the problem==
===Step
Since this Scrabble cheater is a bigger project, and something we'll want to be able to run over and over, we'll need to write it in a text file instead of interactively at the Python interpreter.
Line 63:
===Step
We need to turn the words in the <code>sowpods.txt</code> file into a Python list.
Line 130:
<ul>
<li>
</li>
</ul>
===Step 5: sorting===▼
Now that we have the point values for each valid word, we need to sort them so
<b>Step 5 resources</b>:
<ul>
<li>
Lists, including sorting lists: http://docs.python.org/2/tutorial/datastructures.html#more-on-lists
</li>
</ul>
==Checking your work==
Line 140 ⟶ 151:
<pre>
$ python scrabble.py
2
</pre>
<pre>
$ python scrabble.py ZZAAEEI
22 zeze▼
12 zee▼
12 zea▼
11 za▼
3
▲2 ee
▲2 ea
▲2 ai
▲2 ae
▲2 aa
</pre>
▲===Step 5: sorting===
▲Now that we have the point values for each valid word, we need to sort them so we can print the highest-value words first.
==Bonus challenge==
|