Skillshare intro to Python/Unit 5: Difference between revisions

imported>Jesstess
No edit summary
imported>Jesstess
 
(11 intermediate revisions by the same user not shown)
Line 20:
<pre>
$ python scrabble.py ZAEFIEE
2 eeAE
17 feeze
2 eaAI
17 feaze
2 aiEA
16 faze
2 aeEE
15 fiz
5 ifEF
15 fez
5 feFA
12 zee
5 faFE
12 zea
5 efIF
11 za
6 fieFAE
6 feeFEE
6 faeFIE
11 zaZA
5 if
12 zeeZEA
5 fe
12 zeaZEE
5 fa
15 fizFEZ
5 ef
15 fezFIZ
2 ee
16 fazeFAZE
2 ea
17 FEAZE
2 ai
17 FEEZE
2 ae
</pre>
 
Line 56:
==Breaking down the problem==
 
===Step 10: create a new Python file for the project===
 
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 21: construct a Python word list===
 
We need to turn the words in the <code>sowpods.txt</code> file into a Python list.
Line 130:
<ul>
<li>
Dictionary manipulationDictionaries: http://docs.python.org/tutorial/datastructures.html#dictionaries.
</li>
</ul>
 
 
===Step 5: sorting===
 
Now that we have the point values for each valid word, we need to sort them so weit's caneasy printto see what the highest-value words firstare.
 
<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 AAAaaaaAAA
2 aaAA
</pre>
 
<pre>
$ python scrabble.py ZZAAEEI
2 eeAA
22 zeze
2 eaAE
21 ziz
2 aiAI
12 zee
2 aeEA
12 zea
2 aaEE
11 za
3 aiaAIA
11 zaZE
2 ee
12 zeeZEA
2 ea
12 zeaZEE
2 ai
22 zezeZEZE
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==
Anonymous user