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

Content added Content deleted
imported>Mako
imported>Mako
Line 92: Line 92:
* <tt>if</tt> statements inside <tt>for</tt> loops
* <tt>if</tt> statements inside <tt>for</tt> loops
** e.g., <code>if name[0] in "AEIOU"</code> then print "starts with a vowel"
** e.g., <code>if name[0] in "AEIOU"</code> then print "starts with a vowel"
** we can test it to show how the comparisons are working
** show we can test things outside the loop to show how the comparisons are working
** add an else statement to capture words that start with a consonant
* nested <tt>for</tt> loops
* nested <tt>for</tt> loops
* <tt>range()</tt>
* <tt>range()</tt>