Difference between revisions of "CSC111 Class Page 2014"
(→Second Half (Spring Break-May)) |
|||
(31 intermediate revisions by the same user not shown) | |||
Line 30: | Line 30: | ||
==First Half (Feb-Spring Break)== | ==First Half (Feb-Spring Break)== | ||
<br /> | <br /> | ||
− | <!-- | + | <!-- {| class="mw-collapsible mw-collapsed" style="width:100%" border="1" --> |
− | {| class="mw-collapsible | + | {| class="mw-collapsible" style="width:100%" border="1" |
|- style="background:#ffdead;" | |- style="background:#ffdead;" | ||
|'''Week''' || '''Topics''' || '''Reading''' | |'''Week''' || '''Topics''' || '''Reading''' | ||
Line 422: | Line 422: | ||
==Spring Break == | ==Spring Break == | ||
<br /> | <br /> | ||
− | <center>[[File:animatedBeach.gif]]</center> | + | <!--center>[[File:animatedBeach.gif]]</center--> |
<br /> | <br /> | ||
Line 649: | Line 649: | ||
* [[CSC111 Lab 10 2014 | Lab #10]] and [[CSC111 Lab 10 Solution Programs 2014| solution programs]] | * [[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 10 2014 | Homework #10]] and [[CSC11 Homework 10 Solution Programs 2014| solution programs]] | ||
− | * [[CSC111_Homework_13_2014| Make-up Homework]] | + | * [[CSC111_Homework_13_2014| Make-up Homework]] and [[CSC111_Homework 13 Solution Program 2014| solution program]] |
|| | || | ||
* Reading | * Reading | ||
Line 710: | Line 710: | ||
---- | ---- | ||
* [[CSC111_Lab_11_2014 | Lab #11]] and [[CSC111 Lab 11 Solution Program 2014| solution program]] | * [[CSC111_Lab_11_2014 | Lab #11]] and [[CSC111 Lab 11 Solution Program 2014| solution program]] | ||
− | * [[CSC111 Homework 11 2014| Homework #11]] | + | * [[CSC111 Homework 11 2014| Homework #11]] and [[CSC111 Homework 11 Solution Program 2014| Solution program]] |
|| | || | ||
* Reading | * Reading | ||
Line 737: | Line 737: | ||
*** [http://albus.smith.edu/paris/ http://albus.smith.edu/paris/] | *** [http://albus.smith.edu/paris/ http://albus.smith.edu/paris/] | ||
** What is the field of Digital Humanities? | ** What is the field of Digital Humanities? | ||
− | *** [http://cs.smith.edu/dftwiki/images/DigitalHumanities.key Keynote presentation] ([ | + | *** [http://cs.smith.edu/dftwiki/images/DigitalHumanities.key Keynote presentation] ([http://cs.smith.edu/dftwiki/images/DigitalHumanities.pdf pdf]) |
** Class discussion: Mapping the campus | ** Class discussion: Mapping the campus | ||
<br /> | <br /> | ||
Line 743: | Line 743: | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
− | + | <br /> | |
− | |||
− | |||
− | <br /> | ||
<br /> | <br /> | ||
* '''Friday''' | * '''Friday''' | ||
Line 753: | Line 750: | ||
<center><videoflash>4GxPrESfdnM</videoflash></center> | <center><videoflash>4GxPrESfdnM</videoflash></center> | ||
<br /> | <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 /> | <br /> | ||
---- | ---- | ||
− | * [[CSC111_Lab_12_2014| Lab #12]] | + | * [[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. | + | ** [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 782: | 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. | |
|} | |} | ||
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