O'Reilly Introduction to Python/Section 10: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
 
Line 17: Line 17:
<li>What is the purpose of the variable <tt>i</tt> in the <tt>for</tt> loop?</li>
<li>What is the purpose of the variable <tt>i</tt> in the <tt>for</tt> loop?</li>
<li>What is the purpose of the <tt>input</tt> function?</li>
<li>What is the purpose of the <tt>input</tt> function?</li>
<li>Think about one way that you could extend the script to make it more useful. How would you make that change in code?</li>
</ul>
</ul>
</li>
</li>

Latest revision as of 18:48, 6 April 2014


Goal #1: review the state capitals quizzer

(Estimated completion time: 5 - 10 minutes)

Download the state capitals quizzer demoed in the video:

  1. Download the script and save it to your Desktop. Be sure to save it as a .py file.
  2. Open the script in your text editor.
  3. Read through the script. Think about these questions:
    • Why do we use a dictionary to store the states and capitals?
    • What is the purpose of the variable i in the for loop?
    • What is the purpose of the input function?
    • Think about one way that you could extend the script to make it more useful. How would you make that change in code?

« Back to the section index