Community Data Science Workshops (Fall 2014)/Day 1 lecture: Difference between revisions

Content added Content deleted
imported>Mako
imported>Mako
Line 49: Line 49:
=== Lists ===
=== Lists ===


* purpose
# lists
* initialization
#* purpose
* <tt>len()</tt> review
#* initialization
* accessing elements
#* <tt>len()</tt> review
#* accessing elements
* adding elements
#* adding elements
* changing elements
* slicing lists
#* changing elements
#* slicing lists
* strings are like lists
** len()
#* strings are like lists
*** <code>len("")</code> length of the empty string
#** len()

#*** <code>len("")</code> length of the empty string
# loops and more flow control
=== loops and more flow control ===

#* <tt>for</tt> loops
#* <tt>if</tt> statements inside <tt>for</tt> loops
* <tt>for</tt> loops
#* nested <tt>for</tt> loops
* <tt>if</tt> statements inside <tt>for</tt> loops
#* <tt>range()</tt>
* nested <tt>for</tt> loops
#* <tt>while</tt> loops
* <tt>range()</tt>
#* infinite loops
* <tt>while</tt> loops
* infinite loops
#* <tt>if</tt> statements inside <tt>while</tt> loops
* <tt>if</tt> statements inside <tt>while</tt> loops
#* <tt>break</tt>
#* <tt>raw_input()</tt>
* <tt>break</tt>
* <tt>raw_input()</tt>
# dictionaries

#* purpose
=== dictionaries ===
#* initialization
* purpose
#* accessing elements
* initialization
#* adding elements
#* changing elements
* accessing elements
* adding elements
#* <tt>keys()</tt> and <tt>values()</tt>
* changing elements
# modules
* <tt>keys()</tt> and <tt>values()</tt>
#* purpose

#* builtins
=== modules ===
#* imports
* purpose
#* <tt>import random</tt>
* builtins
#* <tt>random.randint</tt>
* imports
#* <tt>random.choice</tt>
* <tt>import random</tt>
#* walk through state_capitals.py
* <tt>random.randint</tt>
* <tt>random.choice</tt>
* walk through state_capitals.py


Where state_capitals.py from http://mako.cc/teaching/2014/cdsw/state_capitals.py is the grand finale and synthesis of lecture material.
Where state_capitals.py from http://mako.cc/teaching/2014/cdsw/state_capitals.py is the grand finale and synthesis of lecture material.