Difference between revisions of "CSC111 Class Page 2014"
(→First Half) |
|||
(294 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 09:58, 7 January 2014 (EST) | --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 09:58, 7 January 2014 (EST) | ||
---- | ---- | ||
− | <center>[[CSC111_2014 | Main Page]] | [[CS111_Syllabus_2014 | Syllabus ]] | [[CSC111_Class_Page_2014 | Weekly Schedule ]] | [[CSC111_Class_Page_2014#Links_and_Resources | Links & Resources ]] | [http://piazza.com/smith/spring2014/csc111/home Piazza] | [http://cs.smith.edu/classwiki/index.php/Computer_Science_TA_hours TA Hours]</center> | + | <center>[[CSC111_2014 | Main Page]] | [[CS111_Syllabus_2014 | Syllabus ]] | [[CSC111_Class_Page_2014 | Weekly Schedule ]] | [[CSC111_Class_Page_2014#Links_and_Resources | Links & Resources ]] | [http://piazza.com/smith/spring2014/csc111/home Piazza] | [http://cs.smith.edu/classwiki/index.php/Computer_Science_TA_hours TA Hours] | [http://www.mantatech.com/manta/blankwht.htm WHITE]</center> |
<br /> | <br /> | ||
---- | ---- | ||
Line 14: | Line 14: | ||
Ford Hall, 356.<br /> | Ford Hall, 356.<br /> | ||
Telephone: 3854<br /> | Telephone: 3854<br /> | ||
− | Office hours Monday, 2-4 p.m., | + | Office hours Monday, 2-4 p.m., Wednesday 1-3 p.m., and by appointments |
| width="30%" | | | width="30%" | | ||
| | ||
Line 22: | Line 22: | ||
To see when and where TAs are available this week, click [http://cs.smith.edu/classwiki/index.php/Computer_Science_TA_hours here]. | To see when and where TAs are available this week, click [http://cs.smith.edu/classwiki/index.php/Computer_Science_TA_hours here]. | ||
− | <onlydft> | + | <!--onlydft> |
Ideas for next time: http://www.pippinbarr.com/games/theartistispresent/TheArtistIsPresent.html | Ideas for next time: http://www.pippinbarr.com/games/theartistispresent/TheArtistIsPresent.html | ||
− | </onlydft> | + | </onlydft--> |
=Weekly Schedule= | =Weekly Schedule= | ||
<br /> | <br /> | ||
− | ==First Half== | + | ==First Half (Feb-Spring Break)== |
<br /> | <br /> | ||
− | {| style="width:100%" border="1" | + | <!-- {| class="mw-collapsible mw-collapsed" style="width:100%" border="1" --> |
+ | {| class="mw-collapsible" style="width:100%" border="1" | ||
|- style="background:#ffdead;" | |- style="background:#ffdead;" | ||
|'''Week''' || '''Topics''' || '''Reading''' | |'''Week''' || '''Topics''' || '''Reading''' | ||
Line 81: | Line 82: | ||
* [[CSC111 Lab 1 Preparation 2014 | Preparation for Lab #1]] <== <font color="magenta">Please do this if you plan on using your own laptop during the labs</font> | * [[CSC111 Lab 1 Preparation 2014 | Preparation for Lab #1]] <== <font color="magenta">Please do this if you plan on using your own laptop during the labs</font> | ||
* [[CSC111_Lab_1_2014 | Lab #1]] & [[CSC111_Lab_1_Solutions_2014 | Lab1 Solution Programs]] | * [[CSC111_Lab_1_2014 | Lab #1]] & [[CSC111_Lab_1_Solutions_2014 | Lab1 Solution Programs]] | ||
− | * [[CSC111_HW_1_2014 | Homework #1]] | + | * [[Image:videoLogo.png| 50px | right | link=http://www.youtube.com/watch?v=TU2zzMM7v4A]] [[CSC111_HW_1_2014 | Homework #1]], [[CSC111 HW 1 Solutions| solution programs]], and [http://www.youtube.com/watch?v=TU2zzMM7v4A video comments] |
|| | || | ||
* Reading | * Reading | ||
Line 94: | Line 95: | ||
** [[Media:JuliaEdwardsStudentResource.pdf | Message from student liaisons]] | ** [[Media:JuliaEdwardsStudentResource.pdf | Message from student liaisons]] | ||
** <font color="magenta">'''The two-letter Id needed to submit your program is available [[CSC111_2-Letter_Ids_2014 | here]]!</font> | ** <font color="magenta">'''The two-letter Id needed to submit your program is available [[CSC111_2-Letter_Ids_2014 | here]]!</font> | ||
− | ** Meet Guido van Rossum<br /><center><videoflash>ugqu10JV7dk</videoflash><br /> | + | ** Meet Guido van Rossum<br /><!--center><videoflash>ugqu10JV7dk</videoflash-->[[Image:videoLogo.png|right|50px|link=http://www.youtube.com/watch?v=ugqu10JV7dk]]<br /> |
** '''Variables''': | ** '''Variables''': | ||
*** They are labels for ''boxes'' containing information. Boxes in memory. | *** They are labels for ''boxes'' containing information. Boxes in memory. | ||
Line 113: | Line 114: | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
− | [[Image:FulghumAllINeedToKnow.png|right|150px]] | + | [[Image:videoLogo.png|right|50px|link=http://www.youtube.com/watch?v=DbNoNoHyfDc]][[Image:FulghumAllINeedToKnow.png|right|150px]] |
− | ** Discussion of the [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf pair-programming article] in class.<br /><videoflash>DbNoNoHyfDc</videoflash><br /> | + | ** Discussion of the [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf pair-programming article] in class.<br /><!--videoflash>DbNoNoHyfDc</videoflash--><br /> |
** Continue with ATM/Teller machine example: The importance of pseudo-code, and going one step at a time. | ** Continue with ATM/Teller machine example: The importance of pseudo-code, and going one step at a time. | ||
** Changing a float into an int, and vice versa | ** Changing a float into an int, and vice versa | ||
** Functions: '''print()''', '''abs()''', '''trunc()''' (predefined) | ** Functions: '''print()''', '''abs()''', '''trunc()''' (predefined) | ||
+ | <br /> | ||
+ | * '''Friday''' | ||
+ | ** Review of Lab 2 | ||
+ | ** Q&A | ||
** Strings and string methods ([http://docs.python.org/release/2.5.2/lib/string-methods.html documentation]) | ** Strings and string methods ([http://docs.python.org/release/2.5.2/lib/string-methods.html documentation]) | ||
− | ** | + | ** A review of what we have learned so far |
− | + | ** Learn how to use [http://python.org http://python.org] and [http://doc.python.org http://doc.python.org] | |
− | |||
<br /> | <br /> | ||
---- | ---- | ||
− | * [[CSC111 Lab 2 | + | [[Image:videoLogo.png| right | 50px | link=http://www.youtube.com/watch?feature=player_embedded&v=qwEDoAGB3NE ]] |
+ | * [[CSC111 Lab 2 2014 | Lab #2]] and [[CSC111 Lab 2 Solutions 2012 | Lab #2 Solution Programs]] | ||
+ | * [[CSC111 Homework 2 2014 | Homework #2]] and [[CSC111 Homework 2 Solutions 2014 | solutions programs]]. | ||
|| | || | ||
* Reading | * Reading | ||
** Read the [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf article] on pair programming. We will discuss it in class on Wednesday. | ** Read the [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf article] on pair programming. We will discuss it in class on Wednesday. | ||
** Finish reading Chapter 2 by the end of this week. | ** Finish reading Chapter 2 by the end of this week. | ||
− | ** Read Chapter 3 up to Section 3.6 (not included) before Monday 2/10. | + | ** Read Chapter 3 up to Section <u>3.6</u> 3.8 (not included) before Monday 2/10. |
+ | ** Add | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
| Week 3 <br /> 2/10<br /> | | Week 3 <br /> 2/10<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz #2 on Chapter 3. '''Go to Moodle, select CSC111, and locate the Quiz in the "Week 2-Chapter 3" section'''.''' The quiz closes Monday at 10:59 a.m. | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** A quick glimpse of what's ahead: [[CSC111 Blocking Code into Functions | Code Blocks]] | ||
+ | ** '''If-statements''' | ||
+ | *** Flowcharts | ||
+ | *** The idea of boolean values, George Boole (1815-1864), 2-way directionals | ||
+ | *** Relational operators < <= > >= ==, != | ||
+ | *** Exercise 1: Revisiting the [[CSC111 ATM.py program | ATM program]] | ||
+ | *** Exercise 2: Printing a tight box around 3 strings of unknown length: [[CSC111 FindMax.py with If Statements | FindMax.py]] | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** [http://doodle.com/55r4ffdtymrcfyg8 Poll] for Lab Section 1 students | ||
+ | ** Continue exercises from Monday | ||
+ | *** Exercise 3 (tricky!): Same as Exercise 2 but using this approach: <tt> print( "|%30s|" % name )</tt>, where 30 is the max | ||
+ | *** More [[CSC111 Exercises with IF statements 2014 | exercises]]! | ||
+ | *** Negating a boolean expression (point inside a rectangle) | ||
+ | *** Boolean variables | ||
+ | *** Rock, Paper, Scissors | ||
+ | <br > | ||
+ | * '''Thursday''' | ||
+ | ::<font color="magenta">Enjoy the day off! Enjoy the snow! Please do Lab 3 on your own and pick a time when TAs are available to help you out."</font> | ||
+ | <!--center>[[Image:CalvinSnow.gif]]</center--> | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Revisit [[CSC111 Rock-Paper-Scissors Game| the Rock-Paper-Scissors]] program | ||
+ | ** Boolean variables: how can we use them? How does one operate with them? | ||
+ | ** [[CSC111 Exercise Boolean Variables| Some exercises]] | ||
+ | |||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[Image:videoLogo.png|50px|right|link=http://www.youtube.com/watch?v=1FomulmEjuk]][[CSC111 Lab 3 2014 | Lab #3]] and [[CSC111 Lab3 Solutions 2014| solution programs]] |
+ | * [[CSC111 Homework 3 2014 | Homework #3]] and [[CSC111 Homework 3 Solution Programs 2014| solution programs]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** Finish reading Chapter 3 this week! |
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
| Week 4 <br /> 2/17<br /> | | Week 4 <br /> 2/17<br /> | ||
|| | || | ||
− | * '''Monday''' | + | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on Chapter 4: '''While Loops'''. The quiz will cover only While loops, from Section 4.1 to 4.5 included. The quiz will close right before Monday's class. |
− | * '''Wednesday''': <font color="magenta">RALLY DAY</font> | + | * '''Monday''': |
+ | |||
+ | ** Watch the exchange between the robot played by Robin Williams and his owner, played by Sam Neil in the 1999 movie ''[http://youtu.be/REuNQvcN8tg?t=7m10s Bicentenial Man]". Here one of the two "people" having a conversation is an ultra-logical being: a robot, who is not fully aware of the subtleties of the art of (human) conversation: | ||
+ | <br /> | ||
+ | <center><videoflash>REuNQvcN8tg</videoflash> | ||
+ | <br />(advance the movie to 7 minutes and 10 seconds)<br /></center> | ||
+ | <br /> | ||
+ | ** Debugging with '''print()''' statements: it works! Applying this technique to an [[CSC111 Debugging with Print Statements| exercise]] | ||
+ | ** The different parts of a while loop. The flow of control. | ||
+ | ** [[CSC111 Semantic Variations of the While Loop| Semantic variations of the while loop]] | ||
+ | ** Warning: '''infinite loops!''' | ||
+ | ** The role of a sentinel. What is a sentinel? | ||
+ | ** [[CSC111 While Loop Exercises| Exercises with While Loops]] | ||
+ | <br /> | ||
+ | * '''Wednesday''': <font color="magenta">RALLY DAY</font> Lab 1 will be split in 2 sections, one Wed. 7-9 p.m., and one Thursday 7-9 p.m.. Both will be in '''Ford Hall 342'''. | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Comments about [[CSC111_Lab_4_2014 | Lab #4]], Challenge 4: | ||
+ | :::''Modify the program above so that it stops 1) if the user enters -1 2) '''or''' when the sum of the numbers is greater than 20.'' | ||
+ | ** [[Image:videoLogo.png| 50px | right | link=http://www.youtube.com/watch?v=ELRMtELi0zE]] [[Image:videoLogo.png| 50px | right | link=http://www.youtube.com/watch?v=6x2qtLrQdqU]] Working with sentinels | ||
+ | ** [[CSC111 Sentinel Example 1 | Example 1 ]] | ||
+ | ** [[CSC111_Sentinel_Example_1#Example_2 | Example 2 ]], reading Emily Dickinson's poetry | ||
+ | ** Two illustrative videos for running Python on the command line. | ||
<br /> | <br /> | ||
− | + | <br /><br /><br /><br /><br /><br /> | |
---- | ---- | ||
− | * | + | * [[CSC111_Lab_4_2014 | Lab #4 ]] and [[CSC111 Lab 4 Solutions 2014| Solution Programs]] |
+ | * [[CSC111_Homework_4_2014 | Homework 4]] and [[CSC111 Homework 4 Solutions 2014| solution programs]] | ||
|| | || | ||
− | * Reading | + | * Reading Chapter 4, first half on '''While loops''' for Monday 2/17, second half on '''For loops''' during the week. |
* | * | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 163: | Line 218: | ||
| Week 5 <br /> 2/24<br /> | | Week 5 <br /> 2/24<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on the second half of Chapter 4: '''for Loops'''. The quiz will cover only for loops, from Section 4.6 to the end of Chapter 4. The quiz will close right before Monday's class. | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** For-Loops: review what they do, how they work | ||
+ | ** Playing with sound files | ||
+ | ** A bit of physics | ||
+ | ** <center><videoflash>s9GBf8y0lY0</videoflash><br />Physics of sound: A metal plate is connected to an oscillator and frequency is increased...</center> | ||
+ | |||
+ | ** <center><videoflash>cK2-6cgqgYA</videoflash><br />The source of waves] (1933). You may skip after the first 6 minutes.</center> | ||
+ | ** [[File:SoundWave.jpg|right|100px]] Media Files | ||
+ | *** [[media:hello.wav |hello.wav]] | ||
+ | *** [[media:goodbye.wav|goodbye.wav]] | ||
+ | *** [[media:dratcomp.wav|dratcomp.wav]] | ||
+ | *** [[media:force.wav|force.wav]] | ||
+ | *** [[media:takeover.wav|takeover.wav]] | ||
+ | *** [[Media:guitar.wav | guitar.wav]] | ||
+ | ** Basic JES program to play sound file | ||
+ | <source lang="python"> | ||
+ | |||
+ | file = pickAFile() | ||
+ | sound = makeSound( file ) | ||
+ | blockingPlay( sound ) | ||
+ | |||
+ | </source> | ||
+ | ** Basic functions can be found [[CSC111 Basic JES Sound Functions | here]] | ||
+ | ** Exercise 1: reduce the sound intensity by half | ||
+ | ** Exercise 2: play the sound file backwards | ||
+ | ** The print() function is getting more powerful by the minute! '''sep''' and '''end''' parameters! | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** The print() function is getting more powerful by the minute! '''sep''' and '''end''' parameters! | ||
+ | ** Simple sound modification [[CSC111 Sound Modification Exercises |exercises]]. | ||
+ | <br /> | ||
+ | [[File:DontBeAChimp.png|right|130px]] | ||
* '''Friday''' | * '''Friday''' | ||
<br /> | <br /> | ||
− | + | ** A word about Homework 3 | |
+ | ** A word about Homework 5 | ||
+ | ** [https://github.com/fogleman/Minecraft/blob/master/main.py Example of a well-documented Python program] | ||
+ | ** How to move a group of samples (word) from one place to another in a sound array? | ||
+ | ** [[Image:videoLogo.png|50px|right| link=http://cs.smith.edu/dftwiki/index.php/CSC111_Exercises_with_For-Loops:_Repeating_things]]How to swap two samples in an array? | ||
+ | ** [[CSC111 Exercises with For-Loops: Repeating things | Exercises on simple (non-nested) for-loops]] | ||
+ | <br /> | ||
+ | <br /> | ||
---- | ---- | ||
− | * | + | * [[Image:videoLogo.png| 50px | right | link=http://www.youtube.com/watch?v=P1Myggumnso]] [[CSC111_Lab_5_2014 | Lab #5 ]] and [[CSC111_Lab_5_Solutions_2014 | solution programs]] |
+ | * [[CSC111_Homework_5_2014 | Homework #5]] and [[CSC111 Homework 5 Solution Programs 2014|solution programs]]. A [[CSC111_Sample_Poems_2014| sample of poems generated]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** Chapter 4 on For-Loops. The quiz for Monday will ask questions about material seen in class the week of 2/24. |
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
| Week 6 <br /> 3/3<br /> | | Week 6 <br /> 3/3<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on '''for Loops'''. The quiz will close right before Monday's class. | ||
+ | <br /> | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Q&A | ||
+ | *** What is printed by this test? | ||
+ | ::::<source lang="python"> | ||
+ | if False==False: | ||
+ | print( "Chocolate" ) | ||
+ | else: | ||
+ | print( "Spinach" ) | ||
+ | </source> | ||
+ | ** Functions. | ||
+ | *** Definition | ||
+ | *** Examples of functions that print simple messages. | ||
+ | :::<source lang="python"> | ||
+ | def greetings(): | ||
+ | print( "-----" ) | ||
+ | print( "Hello" ) | ||
+ | print( "-----" ) | ||
+ | </source> | ||
+ | *** functions can be called inside loops... | ||
+ | *** Playing a [[CSC111_Games_around_Functions| game]] with functions | ||
+ | *** function parameters: creating a function that prints a string with a box around it. | ||
+ | *** Playing more sophisticated [[CSC111_Games_around_Functions| games]]<!-- | ||
+ | |||
+ | --> | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** [[CSC111 Exercises with functions | Exercises with Functions]] | ||
+ | ** Functions can shorten their work by using '''return''' | ||
+ | ** Functions returning '''values''' | ||
+ | *** Examples | ||
+ | :::<source lang="python"> | ||
+ | def add( a, b ): | ||
+ | return a+b | ||
+ | |||
+ | # try the above function with numbers, ints, floats, and strings! | ||
+ | |||
+ | def intAverage( a, b ): | ||
+ | return ( int(a)+ int(b) )//2 | ||
+ | |||
+ | def printWinner( human, computer ): | ||
+ | if human==computer: | ||
+ | print( "It's a tie!" ) | ||
+ | elif human < computer: | ||
+ | print( "I WIN!" ) | ||
+ | else: | ||
+ | print( "I let you win..." ) | ||
+ | |||
+ | |||
+ | |||
+ | </source> | ||
+ | <br /> | ||
+ | *** [[CSC111 Exercises with Value Returning Functions | Exercises with Value-Returning Functions]] | ||
+ | ** [[Image:videoLogo.png|50px|right| link=http://www.youtube.com/watch?v=oV6z_hGFtSQ]][[CSC111 Top-Down Rock-Paper-Scissors| Top-Down design]] | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
<br /> | <br /> | ||
+ | ** [[CSC111 Top-Down Rock-Paper-Scissors| Top-Down design]] | ||
+ | ** Review of [[CSC111_Lab_6_2014| Lab #6]] | ||
+ | ** Comments on Homework 4. | ||
+ | *** Look at the [[CSC111 Homework 4 Solutions 2014| solution programs]] | ||
+ | *** What should you put in a header? | ||
+ | *** If the assignment does not specify that the program will input data from the keyboard, don't use '''input()''' statements!!! | ||
+ | *** PAY ATTENTION TO DETAILS!!! | ||
+ | *** Add blank lines to highlight natural (logical) divisions | ||
+ | *** Break long lines into shorter ones | ||
+ | *** One should understand the structure of a program by scanning it quickly. | ||
+ | ** The dynamics of returning from a function | ||
+ | :::<source lang="python"> | ||
+ | def f1( a, b): | ||
+ | c = a+b | ||
+ | if a < c: | ||
+ | return | ||
+ | print( "case 1" ) | ||
+ | if a > 0: | ||
+ | print( "case 2" ) | ||
+ | else: | ||
+ | print( "case 3" ) | ||
+ | return | ||
+ | print( "a=%d b=%d c=%d" % (a,b,c) ) | ||
+ | |||
+ | # what's the output generated by the following calls? | ||
+ | f1( 3, 2 ) | ||
+ | f1( -3, 2 ) | ||
+ | f1( 3, -2 ) | ||
+ | f1( -3, -2 ) | ||
+ | </source> | ||
+ | ** Nested-For Loops | ||
+ | ** [[CSC111 Exercises on nested for-loops | Exercises on Nested For-Loops]] | ||
---- | ---- | ||
− | * | + | * [[CSC111_Lab_6_2014| Lab #6]] and [[CSC111 Lab 6 Solutions 2014| Solution Programs]] |
+ | * [[CSC111_Homework_6_2014 | Homework #6]] and [[CSC111 Homework 6 Solution 2014| solution program]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** We're starting learning about functions this week. They are documented in Chapter 5 of the textbook. |
+ | ** We'll cover functions that do not return values first, then functions that return values next. | ||
+ | ** As soon as we understand functions enough we'll jump back to Chapter 4 to look at nested for-loops. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
| Week 7 <br /> 3/10<br /> | | Week 7 <br /> 3/10<br /> | ||
|| | || | ||
+ | <font color="red">No Quiz this weekend (3/8, 3/9)!</font> | ||
* '''Monday''' | * '''Monday''' | ||
+ | [[Image:RGBColorDecimal.gif| right|100px]] | ||
+ | ** [http://cs.smith.edu/dftwiki/images/redEyes.bmp redEyes.bmp] | ||
+ | ** [http://cs.smith.edu/dftwiki/images/catHat.bmp catHat.bmp] | ||
+ | ** Nested for-loops with Python Tutor | ||
+ | ** Digital images. Pixels, colors, RGB format, width, height, coordinate system. | ||
+ | *** Exploring RGB system with JES: | ||
+ | :::<br /><source lang="python"> | ||
+ | color=pickAColor() | ||
+ | </source><br /> | ||
+ | ** JES functions for processing images: | ||
+ | ** Processing images: | ||
+ | *** Changing the colors of an image | ||
+ | *** Making an image black and white | ||
+ | *** Swapping Red, Green and Blue components | ||
+ | *** Adding a border to the image | ||
+ | *** Changing the red eyes to black | ||
+ | *** [[CSC111 JES Program for Image Processing| Skeleton Program]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | ** <font color="magenta">'''in-class MIDTERM EXAM'''</font> | + | ** <font color="magenta">'''in-class MIDTERM EXAM'''</font> and an example of [[CSC111 Midterm Preparation| the format that will be used]] |
+ | <br /><center>[[Image:melonCatInFog.png|400px]]<br />Youyou's cats, created during Lab 7 Session 1</center> | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Go over [[CSC111_Lab_7_2014| Lab #7]] solution programs | ||
+ | ** [[Image:realProgrammersButton.png|right|150px]] Comments on [[CSC111_Homework_5_2014 | Homework # 5]] (returned) and [[CSC111_Homework_7_2014 | Homework #7]] (due Thursday after the break) | ||
+ | *** '''Pay attention to details!''' | ||
+ | *** Imports at top | ||
+ | *** Make the computer compute! | ||
+ | |||
+ | ** [[CSC111 Why 255? | Why 255?]] | ||
+ | ** [[CSC111 Adding a Red Disk to an Image | Adding a disk to an image]] | ||
+ | ** [[CSC111 And now, something completely different | And now, something completely different...]] | ||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[Image:videoLogo.png| 50px | right | link=https://www.youtube.com/watch?v=djlyqdaAOQ0]] [[CSC111_Lab_7_2014| Lab #7]] and [[CSC111 Lab 7 Solutions 2014| Solution Programs]] |
+ | * [[CSC111_Homework_7_2014 | Homework #7]] and [[CSC111_Homework 7 Solution 2014| Solution Programs]] | ||
|| | || | ||
* Reading | * Reading | ||
+ | ** A Good introduction to image processing with JES can be found [http://www.cs.uregina.ca/Links/class-info/325/PythonPictures/ here]. | ||
* | * | ||
|} | |} | ||
+ | <!--/div--> | ||
<br /> | <br /> | ||
==Spring Break == | ==Spring Break == | ||
+ | <br /> | ||
+ | <!--center>[[File:animatedBeach.gif]]</center--> | ||
<br /> | <br /> | ||
− | + | ==Second Half (Spring Break-May)== | |
− | ==Second Half== | ||
<br /> | <br /> | ||
− | {| style="width:100%" border="1" | + | {| class="mw-collapsible" style="width:100%" border="1" |
|- style="background:#ffdead;" | |- style="background:#ffdead;" | ||
|'''Week''' || '''Topics''' || '''Reading''' | |'''Week''' || '''Topics''' || '''Reading''' | ||
Line 221: | Line 437: | ||
|width="60%"| | |width="60%"| | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Lists | ||
+ | ** Lists are ''containers''. Two types of lists: [...] (mutable) and (...) (immutable) | ||
+ | ** Review: creating a list. Empty list and '''append''' operation. | ||
+ | ** Review: len() and indexing | ||
+ | ** New: indexing from the end | ||
+ | ** Review: traversing lists | ||
+ | ** New: list '''reference'''. Lists are ''shared''! | ||
+ | ** New: '''inserting''' elements in a list | ||
+ | ** New: '''testing''' if an element is in the list with '''in''' | ||
+ | ** [[CSC111 Exercises with Lists| Exercises]] and [[CSC111_Exercises_with_Lists#Solution_Program| Solution program]] | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** A word about Homework #6: <font color="magenta">Keep all the function definitions at the top!</font> ([[CSC111 Homework 6 Solution 2014|example]]) | ||
+ | ** Lists are ''data structures''. [http://www2.hawaii.edu/~esb/2013fall.ics211/LinkedList.java.html An example of a list implementation in Java]... | ||
+ | ** [[Image:Slicing.png|100px|right]]Continue with the [[CSC111 Exercises with Lists| list exercises]] of Monday | ||
+ | ** Slicing Lists | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Review of [[CSC111 Lab 8 Solution Program 2014| solution programs]] for Lab #8 | ||
+ | ** Dissecting [[CSC111 Examples of Operations on Lists | examples dealing with typical list operations]] | ||
+ | ** [[CSC111 Exercises on lists of lists | Exercises on lists of lists]] | ||
+ | ** A word about ''list comprehension'' (<font color="red">Advanced material...</font>) ([[CSC111 List Comprehension Exercises|Exercises]]) | ||
+ | ** A word about ''filtering'' data, ''analytics'', and [http://en.wikipedia.org/wiki/Data_science ''data science''] | ||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[CSC111 Lab 8 2014 | Lab #8]] and [[CSC111 Lab 8 Solution Program 2014| solution programs]] |
+ | * [[CSC111 Homework 8 2014 | Homework #8]] and [[CSC111 Homework 8 Solution Programs 2014| solution programs]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** Read Chapter 6 on Lists |
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
Line 235: | Line 473: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** A word about the [[Media:CSC111_Quiz6.pdf|quiz]] | ||
+ | ** A word about the Wolfram language<br /><center><videoflash>_P9HqHVPeik</videoflash></center><br /> | ||
+ | ** Price of a bit | ||
+ | <blockquote> | ||
+ | {| | ||
+ | ! technology | ||
+ | ! cost | ||
+ | ! speed | ||
+ | |- | ||
+ | | | ||
+ | RAM: | ||
+ | | | ||
+ | 8GB @ $80 ( 0.01 cents/MB ) | ||
+ | | | ||
+ | 6,000 to 17,000 MB/s | ||
+ | |- | ||
+ | | | ||
+ | SSD | ||
+ | | | ||
+ | 256GB @ $190 (0.0007 cents/MB) | ||
+ | | | ||
+ | 600 MB/s | ||
+ | |- | ||
+ | | | ||
+ | Hard Disk | ||
+ | | | ||
+ | 2 TB @ $160 ( 0.00008 cents/MB) | ||
+ | | | ||
+ | 90 MB/s | ||
+ | |} | ||
+ | </blockquote> | ||
+ | ** Working with files. Files are an essential part of a computer, and they are maintained by the operating system. | ||
+ | ** How hard disks work:<br /><center><videoflash>Wiy_eHdj8kg</videoflash></center><br /> | ||
+ | ** The evolution of hard disk technology. Examples | ||
+ | ** The evolution of programming languages. | ||
+ | ** How are characters stored on disk (and in memory)? | ||
+ | *** [http://www.asciitable.com/ ASCII Table] ('''A'''merican '''S'''tandard '''C'''ode for '''I'''nterchange of '''I'''nformation) | ||
+ | *** [http://www.fileformat.info/info/charset/UTF-8/list.htm UTF-8] (('''U'''niversal Character Set) '''T'''ransformation '''F'''ormat) | ||
+ | ** Typical file operations: | ||
+ | **# open file for reading | ||
+ | **# read whole file into a variable (string or list) | ||
+ | **# close file | ||
+ | ** or | ||
+ | **# open file for writing | ||
+ | **# write one or several variables to file | ||
+ | **# close file | ||
+ | ** Examples: | ||
+ | *** Write | ||
+ | :::<source lang="python"> | ||
+ | # write some variables to file | ||
+ | name = "Smith College" | ||
+ | address = "1 Elm st., Northampton, MA 01063" | ||
+ | file = open( "college.txt", "w" ) | ||
+ | file.write( "%s\n" % name ) | ||
+ | file.write( "%s\n" % address ) | ||
+ | file.write( "Amherst College\n" ) | ||
+ | file.write( "Amherst, MA, 01002\n" ) | ||
+ | file.close() | ||
+ | </source> | ||
+ | *** Read | ||
+ | :::<source lang="python"> | ||
+ | # read the same file back and print all the lines | ||
+ | file = open( "college.txt", "r" ) | ||
+ | for line in file: | ||
+ | print( "line =", line.strip() ) | ||
+ | file.close() | ||
+ | </source> | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** <font color="magenta">Remember to use the [https://docs.python.org/3.3/contents.html docs.python.org] pages for reference!</font> | ||
+ | ** '''What is the file path?''' | ||
+ | *** Under Windows 7 | ||
+ | *** Under Mac OSX | ||
+ | *** The concept of '''Current Directory''' | ||
+ | *** The concept of '''Parent Directory''' | ||
+ | *** The concept of the '''Root''' of the file system | ||
+ | *** The concept of a '''tree''' data-structure | ||
+ | ** Writing text to file | ||
+ | ** Reading text from file | ||
+ | ** Writing numbers to file | ||
+ | ** Reading numbers from file | ||
+ | ** Creating a log | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** <font color="magenta">Remember to use the [https://docs.python.org/3.3/contents.html docs.python.org] pages for reference!</font> | ||
+ | ** An often forgotten combination of operators: "not in", as in "if x not in List"... | ||
+ | ** A word about Homework 7 | ||
+ | :::<source lang="python"> | ||
+ | |||
+ | height = 100 | ||
+ | yPairs = [] | ||
+ | stripeHeight = height//8 | ||
+ | |||
+ | for y in range( 0, height, height//4 ): | ||
+ | yPairs.append( ( y, y+stripeHeight ) ) | ||
+ | |||
+ | print( yPairs ) | ||
+ | |||
+ | for pair in yPairs: | ||
+ | print( "Stripe ys: ", end="" ) | ||
+ | for y in range( pair[0], pair[1] ): | ||
+ | # display a full row of pixes at 7 | ||
+ | print( y, end=" " ) | ||
+ | print() | ||
+ | </source> | ||
+ | ** Catching errors in Python: ''exceptions'' | ||
+ | *** [https://docs.python.org/3.3/tutorial/errors.html The Python documentation] | ||
+ | *** [[CSC111 Exercises with Exceptions: try/except| Exercises]] | ||
+ | |||
+ | ** (early end of class: Presentation of the Major) | ||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[CSC111_Lab_9_2014 | Lab #9]] and [[CSC111 Lab 9 Solution Programs 2014| solution programs]] |
+ | * [[CSC111_Homework_9_2014 | Homework #9]] and [[CSC111 Homework 9 Solution Programs 2014 | solution programs]] | ||
|| | || | ||
* Reading | * Reading | ||
+ | ** Read Chapter 7 on Files and Exceptions. We are going to concentrate on text files, reading text files and writing text files, and on handling exceptions. You may skip Sections 7.3 and 7.4. | ||
+ | |||
* | * | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 248: | Line 597: | ||
| Week 11 <br /> 4/7<br /> | | Week 11 <br /> 4/7<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on Chapter 7 on '''Files and Exceptions'''. The quiz will close right before Monday's class. | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Catching Errors, Continued | ||
+ | *** [[CSC111 Exercises with Exceptions: try/except| Exercises]] | ||
+ | *** Advantages | ||
+ | **** Cleaner code, easier to write | ||
+ | **** Clear separation of "regular code" and "code handling problems" (see [http://docs.oracle.com/javase/tutorial/essential/exceptions/advantages.html this reference] for an example) | ||
+ | **** Almost same speed as original code when using try/except | ||
+ | ** <font color="magenta">Introduction to Object Oriented Programming</font> (OOP) | ||
+ | *** The concept: a black box with buttons on the front, and a blueprint to help build it. | ||
+ | *** Example 1: [[CSC111_Simple_Programs_Introducing_OOP#Program_1:_NO_OOP|A simple program keeping track of a collection of records]]. Does not use OOP | ||
+ | *** Example 2: [[CSC111_Simple_Programs_Introducing_OOP#Same_Program.2C_using_OOP|The same program, using OOP]]. | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | * '''Friday''' | + | ** Something to learn by heart: '''LIST.append() does not return anything,''', but '''STRING.replace() does''' |
+ | ** Something to remember: '''If a function returns something of a given type, it must always return something of this type. The exception is that it can return ''None'' which does not have a type''' | ||
+ | ** Back to [[CSC111_Simple_Programs_Introducing_OOP#Same_Program.2C_using_OOP|Example 2 from Monday's class]] | ||
+ | ** Rules and definitions | ||
+ | *** The ''interface'' | ||
+ | *** the ''DOT notation''. | ||
+ | *** ''Private'' versus ''public'' member variables | ||
+ | *** ''Private'' versus ''public'' methods | ||
+ | *** What if a method needs to call another method of the same class? | ||
+ | ** Example 3: Creating a '''Dog''' class (use the '''Person''' class as example), with two '''member variables''': | ||
+ | *** a '''tag name''' (string) | ||
+ | *** a '''vaccinated''' status (boolean) | ||
+ | <br /> | ||
+ | * '''Friday''' (''Visit by admitted students'') | ||
+ | ** Reminder: Quiz during the weekend on Python objects and classes | ||
+ | ** int to month name: an easy solution | ||
+ | :::<source lang="python"> | ||
+ | def nameOfMonth( num ): | ||
+ | months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", | ||
+ | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] | ||
+ | return months[ num ] | ||
+ | </source> | ||
+ | ** is "Hello" in the user input? | ||
+ | :::<source lang="python"> | ||
+ | ans = input( "> " ) | ||
+ | if ans.lower().find( "hello" ) == -1: | ||
+ | bePolite( ) | ||
+ | </source> | ||
+ | <br /> | ||
+ | ** Tips & Tricks for programming (life) | ||
+ | *** print | ||
+ | *** start small | ||
+ | ** Creating a new class: '''People''', a list of '''Person''' objects. We build on the [[CSC111_Simple_Programs_Introducing_OOP | previous example seen in class]]. | ||
+ | ** Overview of [[CSC111 Homework 10 2014 | Homework #10]] | ||
<br /> | <br /> | ||
− | |||
---- | ---- | ||
− | * | + | * [[CSC111 Lab 10 2014 | Lab #10]] and [[CSC111 Lab 10 Solution Programs 2014| solution programs]] |
+ | * [[CSC111 Homework 10 2014 | Homework #10]] and [[CSC11 Homework 10 Solution Programs 2014| solution programs]] | ||
+ | * [[CSC111_Homework_13_2014| Make-up Homework]] and [[CSC111_Homework 13 Solution Program 2014| solution program]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | * We will skip Chapter 8 and move on to Chapter 9 this week. |
+ | * Read Chapter 9! | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
| Week 12 <br /> 4/14<br /> | | Week 12 <br /> 4/14<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on '''Classes and Objects'''. The quiz will close right before Monday's class. | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** [[CSC111 Exercises on Classes and Objects | Exercises on objects and classes]] | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | <br /> | ||
+ | ** Graphics (Covered in Chapter 2) | ||
+ | *** The ''window'' | ||
+ | *** The ''canvas'' | ||
+ | *** Horstmann's [[CSC111 Horstmann's Graphics Library | graphic library]] | ||
+ | *** '''Skeleton program''' | ||
+ | :::<source lang="python"> | ||
+ | from graphics import GraphicsWindow | ||
+ | |||
+ | MAXWIDTH = 800 | ||
+ | MAXHEIGHT = 600 | ||
+ | |||
+ | def main(): | ||
+ | win = GraphicsWindow(MAXWIDTH, MAXHEIGHT) | ||
+ | canvas = win.canvas() | ||
+ | |||
+ | #--- add new code here --- | ||
+ | |||
+ | |||
+ | win.wait() | ||
+ | win.close() | ||
+ | |||
+ | main() | ||
+ | </source> | ||
+ | *** Setting the color inside shapes | ||
+ | :::<source lang="python"> | ||
+ | canvas.setFill( red, green, blue ) | ||
+ | </source> | ||
+ | *** Drawing rectangles: | ||
+ | :::<source lang="python"> | ||
+ | canvas.drawRect( x, y, width, height ) | ||
+ | </source> | ||
+ | *** Drawing circles | ||
+ | :::<source lang="python"> | ||
+ | canvas.drawOval( x, y, width, height ) | ||
+ | </source> | ||
+ | |||
+ | <center>[[Image:CarForGraphics.jpg|400px]]</center> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Review of [[CSC111_Lab_11_2014 | Lab #11]] | ||
+ | ** A class with a top and a car without one: a case of '''Class Inheritance''' | ||
+ | ** [[CSC111 Car With Top and Without Hard Top | Building up to an inherited class]] | ||
+ | ** [[CSC111 Exercise with Class Inheritance | Exercise]] | ||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[CSC111_Lab_11_2014 | Lab #11]] and [[CSC111 Lab 11 Solution Program 2014| solution program]] |
+ | * [[CSC111 Homework 11 2014| Homework #11]] and [[CSC111 Homework 11 Solution Program 2014| Solution program]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | * We continue working with objects and classes this week, so the material covered in Chapter 9 is definitely still a good reference to visit and visit again. |
+ | * We will use objects in the context of graphics this week, so the material you already read in Chapter 2 will be a good reference for us. | ||
+ | * One of the appendices in the book has a good coverage of the graphics library (starting Page A-24) and all the methods available. | ||
+ | * Class inheritance is covered in Chapter 10 of the book. Read the first 4 sections (stop at Section 10.5, excluded). | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
| Week 13 <br /> 4/21<br /> | | Week 13 <br /> 4/21<br /> | ||
|| | || | ||
+ | * <font color="red">'''Saturday/Sunday'''</font>: Moodle Quiz on '''Classes and Inheritance'''. The quiz will close right before Monday's class. | ||
+ | <br /> | ||
* '''Monday''' | * '''Monday''' | ||
− | * '''Wednesday''' | + | ** Adding motion to graphic objects. [[CSC111 Moving Graphic Objects | Example]] |
+ | ** Resizing a graphic object. [[CSC111 Resizing Graphic Objects | Example]] | ||
+ | ** [[Image:CallBackSetupForGraphics.png|right|200px]] A new concept: ''Event-Driven Programming'' | ||
+ | ** Adding event-driven capability to out graphics library: [[CSC111 graphics111.py 2014| graphics111.py]] | ||
+ | *** Circle, Wheel, Rectangle and Polygon classes | ||
+ | *** Menu class | ||
+ | *** Example Programs | ||
+ | <br /> | ||
+ | [[Image:HeleneVisentin.jpg|right|150px]] | ||
+ | * '''Wednesday''': | ||
+ | ** '''Guest Lecture:''' Prof. Helene Visentin, on mapping Paris throughout the ages. | ||
+ | *** [http://albus.smith.edu/paris/ http://albus.smith.edu/paris/] | ||
+ | ** What is the field of Digital Humanities? | ||
+ | *** [http://cs.smith.edu/dftwiki/images/DigitalHumanities.key Keynote presentation] ([http://cs.smith.edu/dftwiki/images/DigitalHumanities.pdf pdf]) | ||
+ | ** Class discussion: Mapping the campus | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Animated Objects | ||
+ | <br /> | ||
+ | <center><videoflash>4GxPrESfdnM</videoflash></center> | ||
+ | <br /> | ||
+ | ** [[CSC111 Exercises with Global Variables| Playing with global variables]] | ||
+ | ** [[CSC1111 Lab 12 Solution Programs | A review of Lab #12]] | ||
+ | ** An introduction to sets | ||
+ | *** Console demo | ||
+ | ::::<source lang="python"> | ||
+ | a = { 'dog', 'cat' } | ||
+ | b = set( [] ) | ||
+ | a.add( 'dog' ) | ||
+ | a.discard( 'cat' ) | ||
+ | len( a ) | ||
+ | sorted( a ) | ||
+ | a.intersection( b ) | ||
+ | a.union( b ) | ||
+ | L1 = [ 1, 2, 3, 3, 3, 3, 3, 4, 5 ] | ||
+ | d = set( L1 ) | ||
+ | # Exercise: take a list and remove all its duplicates | ||
+ | # Exercise: count unique words in a string, with lists, with sets | ||
+ | </source> | ||
+ | *** [[CSC111 Counting Unique Words | Example]] | ||
+ | |||
+ | <!--center><videoflash>X347nTSkNNQ</videoflash></center--> | ||
+ | <br /> | ||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[CSC111_Lab_12_2014| Lab #12]] and [[CSC1111 Lab 12 Solution Programs | solution programs]] |
+ | * [[CSC111_Homework_12_2014 | Homework #12]] | ||
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** [http://en.wikipedia.org/wiki/Event-driven_programming Wikipedia has a short article] introducing event-driven programming. |
+ | ** Sets and Dictionaries are covered in Chapter 8. Read Sections 1 and 2, and stop at 8.3. | ||
+ | |||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 292: | Line 788: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Back to the [[CSC111 Counting Unique Words | example]] on sets. Making the counting of unique words even faster! | ||
+ | ** Dictionaries. Dictionaries, like sets, are '''data structures''': data organized in a specific way so as to make some problems easier to write, or faster to execute, or more memory efficient. | ||
+ | ** Playing with dictionaries in the console: | ||
+ | >>> dict = {} | ||
+ | >>> dict = { "apple":1, "pear":3, "banana":6 } | ||
+ | >>> dict | ||
+ | >>> dict[ "pear" ] | ||
+ | >>> dict[ "orange" ] | ||
+ | >>> dict[ "kiwi" ] = 12 | ||
+ | >>> dict.keys() | ||
+ | >>> dict.values() | ||
+ | >>> dict.items() | ||
+ | >>> for key in dict: | ||
+ | print( key ) | ||
+ | >>> for key in dict: | ||
+ | print( key, dict[key] ) | ||
+ | >>> contacts = {} | ||
+ | >>> contacts[ "Marie" ] = "111 22 33" | ||
+ | >>> contacts[ "Alex" ] = "222 33 44" | ||
+ | >>> contacts[ "Francis" ] = "333 44 55" | ||
+ | >>> contacts.pop( "Alex" ) | ||
+ | [[Image:MagicHat.png|150px|right]] | ||
+ | ** Find the frequency of occurrence of words in a sentence | ||
+ | ** Find the 10 most frequent words in James Joyce's Ulysses | ||
+ | ** '''Recursion''' | ||
+ | *** A simple first example: factorials: the mathematical expression, and its version in Python. | ||
+ | *** Wrapping text recursively[[CSC111 Recursive Text-Wrapping|.]] | ||
+ | *** The towers of hanoi | ||
+ | <br /> | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | * '''Friday''': <font color="magenta">Final Take-Home EXAM</font> | + | ** Continue with Factorial Program |
+ | ** [[CSC111_RecursiveFactorial.py| Python code]] | ||
+ | ** Animation [[Media:FactorialCSC111Animation.key.zip | Zipped Keynote]] | ||
+ | <br /> | ||
+ | <center>[[File:AnimatedTowersOfHanoi.gif]]</center> | ||
+ | <br /> | ||
+ | ** Towers of Hanoi, the [https://www.youtube.com/watch?v=Kt3L5nip-FQ movie] | ||
+ | ** [[CSC231_Analysis_of_the_Towers_of_Hanoi|How long would it take for 64 disks?]] | ||
+ | ** [[CSC111_BinarySearch.py | Binary search]] | ||
+ | ** [[CSC111 FractalTree.py | Fractal tree]] | ||
+ | <br /> | ||
+ | * '''Friday''': | ||
+ | ** A couple more words about recursion... | ||
+ | ** [[CSC111 visitMaze.py | maze-visiting program]] | ||
+ | **<font color="magenta">[[CSC111_Final_Exam_2014 |Final Take-Home EXAM]]</font> | ||
+ | <br /> | ||
<br /> | <br /> | ||
− | |||
---- | ---- | ||
− | * | + | * [[CSC111_Lab_13_2014| Lab #13]] and [[CSC111 Lab 13 Solution Program 2014|solution program]] |
|| | || | ||
* Reading | * Reading | ||
− | * | + | ** Dictionaries and sets are covered in Chapter 8. Section 8.3 is especially interesting. |
+ | ** Recursion is covered in Chapter 11. Read up to, but not including, Section 5. | ||
+ | |} | ||
− | + | <br /> | |
=Links and Resources= | =Links and Resources= | ||
− | |||
<br /> | <br /> | ||
+ | ==Map of Smith College== | ||
+ | ===Full Map=== | ||
+ | <br /> | ||
+ | <center> [[Image:SmithMap2.jpg|500px]]</center> | ||
+ | <br /> | ||
+ | ===Reduced Map=== | ||
+ | <br /> | ||
+ | <center>[[Image:SmithMapSmall.gif|500px]]</center> | ||
+ | <br /> | ||
+ | ===Dates of Construction for Smith Buildings=== | ||
+ | <br /> | ||
+ | * The dates for the construction of different buildings on campus are available [[Smith College Building Construction Dates| here]] | ||
+ | <br /> | ||
+ | ===A Skeleton Python Program for Displaying An Image=== | ||
+ | <br /> | ||
+ | <source lang="python"> | ||
+ | # Skeleton program for displaying a gif image. | ||
+ | # D. Thiebaut | ||
+ | # Warning: will not work with a jpg or png image! If you | ||
+ | # need to convert your image to gif, use a Web service. | ||
+ | # | ||
+ | |||
+ | from graphics111 import * | ||
+ | import tkinter as tk | ||
+ | |||
+ | MAXWIDTH = 800 | ||
+ | MAXHEIGHT = 600 | ||
+ | |||
+ | # ======================================================== | ||
+ | # Main Program | ||
+ | # ======================================================== | ||
+ | def main(): | ||
+ | gifFileName = "SmithMapSmall.gif" | ||
+ | # open the window and get access to its canvas | ||
+ | win = GraphicsWindow(MAXWIDTH, MAXHEIGHT) | ||
+ | canvas = win.canvas() | ||
+ | |||
+ | # put gif image on canvas | ||
+ | photo = tk.PhotoImage( file=gifFileName ) | ||
+ | canvas._tkcanvas.create_image(0,0, image=photo, anchor = tk.NW ) | ||
+ | |||
+ | # wait and respond to events, or comment out and make the program | ||
+ | # stop as soon as car disappears. | ||
+ | win.wait() | ||
+ | win.close() | ||
+ | |||
+ | main() | ||
+ | </source> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | |||
+ | ===A Skeleton Event-Driven Program=== | ||
+ | <br /> | ||
+ | <source lang="python"> | ||
+ | # A Skeleton event-driven program | ||
+ | # D. Thiebaut | ||
+ | # | ||
+ | |||
+ | from graphics111 import * | ||
+ | |||
+ | MAXWIDTH = 800 | ||
+ | MAXHEIGHT = 800 | ||
+ | |||
+ | def mouseEvent( win, canvas, x, y ): | ||
+ | global menu | ||
+ | |||
+ | button = menu.buttonClicked( x, y ) | ||
+ | |||
+ | if button == None: | ||
+ | return | ||
+ | |||
+ | if button == "LeftArrow": | ||
+ | return | ||
+ | |||
+ | if button == "RightArrow": | ||
+ | return | ||
+ | |||
+ | if button == "Minus": | ||
+ | return | ||
+ | |||
+ | if button == "Plus": | ||
+ | return | ||
+ | |||
+ | |||
+ | # ======================================================== | ||
+ | # Main Program | ||
+ | # ======================================================== | ||
+ | def main(): | ||
+ | global menu | ||
+ | |||
+ | # open the window and get access to its canvas | ||
+ | win = GraphicsWindow(MAXWIDTH, MAXHEIGHT) | ||
+ | canvas = win.canvas() | ||
+ | canvas.setCallbackFunction( mouseEvent ) | ||
+ | |||
+ | # add a menu to the window | ||
+ | menu = Menu() | ||
+ | menu.draw( canvas ) | ||
+ | |||
+ | # wait and respond to events, or comment out and make the program | ||
+ | # stop as soon as car disappears. | ||
+ | win.wait() | ||
+ | win.close() | ||
+ | |||
+ | main() | ||
+ | </source> | ||
+ | <br /> | ||
+ | |||
+ | ==Graphics Library used in Textbook== | ||
+ | <br /> | ||
+ | * It is available for download [http://bcs.wiley.com/he-bcs/Books?action=resource&bcsId=8083&itemId=1118626133&resourceId=31809 here]. Once downloaded, unzip it and move it to the directory where you are developing your programs. | ||
+ | <br /> | ||
+ | |||
+ | ==All Demo Programs== | ||
+ | <br /> | ||
+ | * A selection of programs created in class can be found [[CSC111 Programs Written in Class 2014| here]] | ||
<br /> | <br /> | ||
==On Line Python books== | ==On Line Python books== | ||
− | + | <br /> | |
* [http://blogs.discovermagazine.com/cosmicvariance/2011/09/08/python/ disocovermagazine.com] blog. Check out the answers posted by many readers. They contain some interesting links that you may find useful! | * [http://blogs.discovermagazine.com/cosmicvariance/2011/09/08/python/ disocovermagazine.com] blog. Check out the answers posted by many readers. They contain some interesting links that you may find useful! | ||
− | + | <br /> | |
==Python keywords== | ==Python keywords== | ||
− | + | <br /> | |
;The list of all the reserved words of the Python language: | ;The list of all the reserved words of the Python language: | ||
:and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass yield def finally in print | :and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass yield def finally in print | ||
Line 324: | Line 980: | ||
* [http://jeremy.zawodny.com/emacs/emacs-2.html A good Emacs tutorial] | * [http://jeremy.zawodny.com/emacs/emacs-2.html A good Emacs tutorial] | ||
* [[Emacs Quick Reference | Emacs Quick Reference]] | * [[Emacs Quick Reference | Emacs Quick Reference]] | ||
− | + | <br /> | |
==Misc== | ==Misc== | ||
+ | <br /> | ||
* If you decide to work in pairs for the homework assignments, you need to follow the protocol for 'pair programming' as discussed in [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf this article]. | * If you decide to work in pairs for the homework assignments, you need to follow the protocol for 'pair programming' as discussed in [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf this article]. | ||
Line 334: | Line 991: | ||
* a video of [http://www.youtube.com/watch?v=x2FimkptxIk digital horses]: what we can do with lists of objects! | * a video of [http://www.youtube.com/watch?v=x2FimkptxIk digital horses]: what we can do with lists of objects! | ||
− | + | <br /> | |
==Software== | ==Software== | ||
− | + | <br /> | |
* Installing and using the [http://www.smith.edu/its/tara/file_transfer/ssh_sftp.html#installing Secure Shell Client] on a Windows PC[http://cs.smith.edu/~thiebaut/classes/111/SecureShell/ .] | * Installing and using the [http://www.smith.edu/its/tara/file_transfer/ssh_sftp.html#installing Secure Shell Client] on a Windows PC[http://cs.smith.edu/~thiebaut/classes/111/SecureShell/ .] | ||
* Using [http://www.math.toronto.edu/admin/ssh.html SSH] on Windows, Linux, or on a Mac with OS X | * Using [http://www.math.toronto.edu/admin/ssh.html SSH] on Windows, Linux, or on a Mac with OS X | ||
− | == | + | <br /> |
+ | |||
+ | =Class Videos= | ||
+ | <br /> | ||
+ | (The tables below were generated by this [[Python: Parse YouTube Uploaded Videos to MediaWiki Tables| Python program]].) | ||
+ | <br /> | ||
+ | {| class="wikitable" | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=YF9dxRkY4E8 http://img.youtube.com/vi/YF9dxRkY4E8/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=YF9dxRkY4E8 <b>CSC111 For-Loop exercises -- Exercise #5</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=TNfI1tO70CE http://img.youtube.com/vi/TNfI1tO70CE/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=TNfI1tO70CE <b>CSC111 For Loop Exercises -- Exercise #4</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=1VXPBeYBiuo http://img.youtube.com/vi/1VXPBeYBiuo/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=1VXPBeYBiuo <b>CSC111 For-Loop Exercises -- Exercise #3</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=y1dv69bSSwk http://img.youtube.com/vi/y1dv69bSSwk/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=y1dv69bSSwk <b>CSC111 For-Loop Exercises -- Exercise #2</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=_FZEwCOyQvA http://img.youtube.com/vi/_FZEwCOyQvA/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=_FZEwCOyQvA <b>CSC111 For-Loop Exercises: Solution for Exercise #1</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=P1Myggumnso http://img.youtube.com/vi/P1Myggumnso/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=P1Myggumnso <b>CSC111 -- Using PythonTutor</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=ELRMtELi0zE http://img.youtube.com/vi/ELRMtELi0zE/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=ELRMtELi0zE <b>Running Python Programs from the Command Line (Mac)</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=6x2qtLrQdqU http://img.youtube.com/vi/6x2qtLrQdqU/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=6x2qtLrQdqU <b>Python on the command line in Windows</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=1FomulmEjuk http://img.youtube.com/vi/1FomulmEjuk/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=1FomulmEjuk <b>CSC111 Intro to Lab 3</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=TU2zzMM7v4A http://img.youtube.com/vi/TU2zzMM7v4A/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=TU2zzMM7v4A <b>CSC111 Notes on Homework 1 2014</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=OCRvN0NJlHg http://img.youtube.com/vi/OCRvN0NJlHg/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=OCRvN0NJlHg <b>Comments for CSC111 TAs on Homework 1</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=qwEDoAGB3NE http://img.youtube.com/vi/qwEDoAGB3NE/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=qwEDoAGB3NE <b>CSC111 Comments on Homework 2</b>]<br /><br /></center> | ||
+ | |- | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=TgZxW6w6w8c http://img.youtube.com/vi/TgZxW6w6w8c/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=TgZxW6w6w8c <b>CSC111 Comments on Lab #1</b>]<br /><br /></center> | ||
+ | | | ||
+ | <center>[http://www.youtube.com/watch?v=bjVO2MZroUU http://img.youtube.com/vi/bjVO2MZroUU/mqdefault.jpg]<br />[http://www.youtube.com/watch?v=bjVO2MZroUU <b>CSC111 Spring 2014: Finding the Class Web Page</b>]<br /><br /></center> | ||
+ | |- | ||
+ | |} | ||
− | |||
<br> | <br> | ||
<br> | <br> |
Latest revision as of 17:35, 10 May 2014
--D. Thiebaut (talk) 09:58, 7 January 2014 (EST)
Contents
Prof and TAs
Dominique Thiébaut email |
|
To see when and where TAs are available this week, click here.
Weekly Schedule
First Half (Feb-Spring Break)
Week | Topics | Reading |
Week 1 1/27 |
x = 3 name = "hello"
|
|
Week 2 2/3 |
|
|
Week 3 2/10 |
|
|
Week 4 2/17 |
(advance the movie to 7 minutes and 10 seconds)
|
|
Week 5 2/24 |
file = pickAFile()
sound = makeSound( file )
blockingPlay( sound )
|
|
Week 6 3/3 |
|
|
Week 7 3/10 |
No Quiz this weekend (3/8, 3/9)!
Youyou's cats, created during Lab 7 Session 1
|
|
Spring Break
Second Half (Spring Break-May)
Week | Topics | Reading | ||||||||||||
Week 9 3/24 |
|
| ||||||||||||
Week 10 3/31 |
|
| ||||||||||||
Week 11 4/7 |
|
| ||||||||||||
Week 12 4/14 |
|
| ||||||||||||
Week 13 4/21 |
|
| ||||||||||||
Week 14 4/28 |
>>> dict = {} >>> dict = { "apple":1, "pear":3, "banana":6 } >>> dict >>> dict[ "pear" ] >>> dict[ "orange" ] >>> dict[ "kiwi" ] = 12 >>> dict.keys() >>> dict.values() >>> dict.items() >>> for key in dict: print( key ) >>> for key in dict: print( key, dict[key] ) >>> contacts = {} >>> contacts[ "Marie" ] = "111 22 33" >>> contacts[ "Alex" ] = "222 33 44" >>> contacts[ "Francis" ] = "333 44 55" >>> contacts.pop( "Alex" )
|
|
Links and Resources
Map of Smith College
Full Map
Reduced Map
Dates of Construction for Smith Buildings
- The dates for the construction of different buildings on campus are available here
A Skeleton Python Program for Displaying An Image
# Skeleton program for displaying a gif image.
# D. Thiebaut
# Warning: will not work with a jpg or png image! If you
# need to convert your image to gif, use a Web service.
#
from graphics111 import *
import tkinter as tk
MAXWIDTH = 800
MAXHEIGHT = 600
# ========================================================
# Main Program
# ========================================================
def main():
gifFileName = "SmithMapSmall.gif"
# open the window and get access to its canvas
win = GraphicsWindow(MAXWIDTH, MAXHEIGHT)
canvas = win.canvas()
# put gif image on canvas
photo = tk.PhotoImage( file=gifFileName )
canvas._tkcanvas.create_image(0,0, image=photo, anchor = tk.NW )
# wait and respond to events, or comment out and make the program
# stop as soon as car disappears.
win.wait()
win.close()
main()
A Skeleton Event-Driven Program
# A Skeleton event-driven program
# D. Thiebaut
#
from graphics111 import *
MAXWIDTH = 800
MAXHEIGHT = 800
def mouseEvent( win, canvas, x, y ):
global menu
button = menu.buttonClicked( x, y )
if button == None:
return
if button == "LeftArrow":
return
if button == "RightArrow":
return
if button == "Minus":
return
if button == "Plus":
return
# ========================================================
# Main Program
# ========================================================
def main():
global menu
# open the window and get access to its canvas
win = GraphicsWindow(MAXWIDTH, MAXHEIGHT)
canvas = win.canvas()
canvas.setCallbackFunction( mouseEvent )
# add a menu to the window
menu = Menu()
menu.draw( canvas )
# wait and respond to events, or comment out and make the program
# stop as soon as car disappears.
win.wait()
win.close()
main()
Graphics Library used in Textbook
- It is available for download here. Once downloaded, unzip it and move it to the directory where you are developing your programs.
All Demo Programs
- A selection of programs created in class can be found here
On Line Python books
- disocovermagazine.com blog. Check out the answers posted by many readers. They contain some interesting links that you may find useful!
Python keywords
- The list of all the reserved words of the Python language
- and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass yield def finally in print
Linux
- Getting Started with Linux (from U. North Carolina, Chapel Hill)
- Intermediate Linux (from U. North Carolina, Chapel Hill)
- A good Emacs tutorial
- Emacs Quick Reference
Misc
- If you decide to work in pairs for the homework assignments, you need to follow the protocol for 'pair programming' as discussed in this article.
- Video talks on Python:
- All the programs of Zelle's Python textbook
- a video of digital horses: what we can do with lists of objects!
Software
- Installing and using the Secure Shell Client on a Windows PC.
- Using SSH on Windows, Linux, or on a Mac with OS X
Class Videos
(The tables below were generated by this Python program.)
Back To Main Page