Python Comp Sci course.
Hey folks, I"m gearing up to teach a Python-based computer science course. I just spent about a week chugging through the list archives (almost quit at the case-sensitivity debates ;) ). I have a few questions: 1. At several points in the past, people have offered to maintain or posted sites hosting lesson plans. Is there a site for these? Where is it? (For example, this one, http://www.ibiblio.org:420/Zope/Python given in December of last year does not work.) 2. I'm interested in doing some kind of iterative instruction using one project to illustrate a lot of the characteristics and functionality of the language. For example (after Lutz): - start with a simple, hard-coded dictionary of names/addresses (an addressbook). Print them out. - add a simple, text-based UI, allowing user to add, delete, edit entries (input/output/UI) - complexify the data stored and move to file based storage (file io, data stores) - add ability to sort (without built-in methods, to learn the algorithms) - add ability to find (more algorithms) - then, move to a GUI? and then.... (I've got lots of ideas - net-based sharing, file input/output, move to a web-based CGI system, etc - just wondering what people think. Also, would this excite students?) 3. I'd like to include a significant amount of history in the class. Can anyone recommend texts related the two main branches of computer science I'd like the talk about: the history of "calculation", including ancient devices like the abacus, quipu, slide-rule (grin) and the theory of numbers/counter/arithmetic, and the history of the computer, focusing on the 20th century? Thoughts, suggestions, comments, references? 4. I'm wondering what people have done for large-scale projects... I'm thinking along these lines: - a primitive sketch/draw program (nice GUI and object lessons here) - a CGI system for the school (alumni database) - Tic-Tac-Toe (with AI), of course - other games (NIM, etc.) - local school chat program Of course I will let the kids make suggestions also, I'm just wondering where people have gone with this. Thanks much, Rob Robert K. Rickenbrode II rkr_ii@yahoo.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
At 11:59 AM 8/24/2001 -0400, Robert Rickenbrode II wrote:
Hey folks, I"m gearing up to teach a Python-based computer science course. I just spent about a week chugging through the list archives (almost quit at the case-sensitivity debates ;) ). I have a few questions:
1. At several points in the past, people have offered to maintain or posted sites hosting lesson plans. Is there a site for these? Where is it? (For example, this one, http://www.ibiblio.org:420/Zope/Python given in December of last year does not work.)
2. I'm interested in doing some kind of iterative instruction using one project to illustrate a lot of the characteristics and functionality of the language. For example (after Lutz): - start with a simple, hard-coded dictionary of names/addresses (an addressbook). Print them out. - add a simple, text-based UI, allowing user to add, delete, edit entries (input/output/UI) - complexify the data stored and move to file based storage (file io, data stores) - add ability to sort (without built-in methods, to learn the algorithms) - add ability to find (more algorithms) - then, move to a GUI? and then.... (I've got lots of ideas - net-based sharing, file input/output, move to a web-based CGI system, etc - just wondering what people think. Also, would this excite students?)
I've done something like this with an "employee database" (very minimal): hardcoded dictionary, add text input and a pickle (with a separate script to read the data to "prove" the object really is restored from the pickle), turn it into a class to give named storage to the fields, add a gui, and eventually push the data to a a mysql database to show that if the modules were "coded right" the interfaces used by the gui and text update/retreive code do not have to change, just the code to access the backend store. I think this is okay, and students like it, but I'd caution to not have it be your /only/ set of examples. It seems to work for me if you occasionally say "okay, now let's come back to our XXX" but it's too much if the single "theme" is the only thing you're showing. My two cents' worth. Mats
On Fri, 24 Aug 2001, Robert Rickenbrode II wrote:
Thoughts, suggestions, comments, references?
Hi Robert, I've just put together my latest version of the "Python Resources" CD that I plan to hand out to my students next week. It contains a mirror of python.org, Alan Gauld's tutorial, and the Python software for Linux, Mac, and Windows. I've also included some other Python apps like PySol, VPython, Pygame, and Zope. It also has a mirror of the "How To Think Like a Computer Scientist" Web pages. I plan to use this as my "textbook" for the year. Please feel free to download an iso of the CD. It's a 230 MB download and can be had via ftp from lists.isd197.org. Look for 'pyresources.iso' in the mail ftp directory. Good luck with your course. I'm getting excited to begin teaching mine. (I'm also a first-time C.S./Python teacher.) I'm also interested in developing a database of lesson plans, project ideas, etc. I be happy to discuss any ideas for how to make it happen. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
* Timothy Wilson <wilson@visi.com> [010827 22:16]:
Please feel free to download an iso of the CD. It's a 230 MB download and can be had via ftp from lists.isd197.org. Look for 'pyresources.iso' in the mail ftp directory.
Tim, that's wonderful! I'm a second year Python teacher and have been putting this off. I'm glad to see my laziness paid off :-) Thanks so much. -J -- Jonathan Pennington | john@coastalgeology.org "It's hard to take life too seriously when you realize yours is a joke." -me
Here's a version of the Extended Euclidean Algorithm, with related inverse and Chinese Remainder Theorem functions. Very old hat stuff in CS, but that's why important. Note I use the new //, which is available in 2.2a2 w/o import from __future__. The EEA returns a 3-tuple, the 0th element being the gcd(a,b), the next two being s,t such that gcd(a,b) = s*a + t*b, i.e. two integers which bring the initial a,b within the gcd of one another. Example:
eea(17,25) # gcd(a,b) = 1 [1, 3, -2] 3*17 - 2*25 # s = 3, t = -2 1
eea(29834,8282) # gcd(a,b) = 2 [2, -88, 317] -88*29834 + 317*8282 # s = -88, t = 317 2
With EEA, you can also find the inverse of x mod n, provided gcd(x,n)=1. The inverse is that number which, multiplying x, gives a remainder of 1 when divided by n. Example: find x such that (x * 7) mod 4 = 1. Computing: >>> inverse(7,4) 3 i.e. (3*7) mod 4 = 21 mod 4 = integer remainder of 21/4 = 1. The Chinese Remainder Theorem states that if I give you a smattering of divisors, all coprime to each other, and tell you what the remainders for each of them is, then you can tell me a number which meets my specifications. Example: Your divisors are 7,11 and 15. The respective remainders are 2, 3 and 0. What's a number that works? Computing: >>> crt([7,11,15],[2,3,0]) 135 Check: >>> 135 % 7 2 >>> 135 % 11 3 >>> 135 % 15 0 Works. The also EEA comes up in CS in connection with RSA. You need it to find secret pair d, matched with e, such that (d*e) mod (p-1)(q-1) = 1, where p,q are the two humongous primes used to generate p*q = n, the public key. There's a more generalized form of the CRT which allows the divisors to not necessarily be coprime to start with (but with another stipulation about the remainders in that case). See Knuth, Art of Computer Programming, Vol 3, pg. 292. Tweaking the code below to accommodate this case might be an exercise. HINT: you'd probably want an lcm function. Kirby ===================== Here's the code: from operator import mod def eea(a,b): """Extended Euclidean Algorithm for GCD""" v1 = [a,1,0] v2 = [b,0,1] while v2[0]<>0: p = v1[0]//v2[0] # floor division v2, v1 = map(sub,v1,[p*vi for vi in v2]), v2 return v1 def inverse(m,k): """ Return b such that b*m mod k = 1, or 0 if no solution """ v = eea(m,k) return (v[0]==1)*(v[1] % k) def crt(ms,as): """ Chinese Remainder Theorem: ms = list of pairwise relatively prime integers as = remainders when x is divided by ms (ai is 'each in as', mi 'each in ms') The solution for x modulo M (M = product of ms) will be: x = a1*M1*y1 + a2*M2*y2 + ... + ar*Mr*yr (mod M), where Mi = M/mi and yi = (Mi)^-1 (mod mi) for 1 <= i <= r. """ M = reduce(mul,ms) # multiply ms together Ms = [M/mi for mi in ms] # list of all M/mi ys = [inverse(Mi, mi) for Mi,mi in zip(Ms,ms)] # uses inverse,eea return reduce(add,[ai*Mi*yi for ai,Mi,yi in zip(as,Ms,ys)]) % M
On Fri, 24 Aug 2001, Robert Rickenbrode II wrote:
Hey folks, I"m gearing up to teach a Python-based computer science course.
robert, sounds great! a good number of people on this list are doing that. i current teach a professional education Python course for UC Santa Cruz Extension (next class is Winter 2002 quarter). it's an 8-week course with one meeting per week. i give quite a bit of homework in this class (as many of my students would attest [and protest] to) :-) many of these exercises are geared towards exercising your creativity while doing some real code to help hammer home the concepts. i put many (if not all) these exercises in the book "Core Python Programming" which i did for Prentice Hall last year. if you are interested in seeing some of the exercises, just let me know!
3. I'd like to include a significant amount of history in the class.
one book that has only a single yet loaded chapter on history is called "Computer Science: An OVerview" by Glenn Brookshear. it's used in *many* college intro courses (hence why i think it's like on its *7th* ed. or something like that)!
Thoughts, suggestions, comments, references?
there are some other courses which use Core Python Programming as a text reference, and some of these courses have websites which may also be of use to you. here are two of them: http://sandbox.mc.edu/~gwiggins/syllabi/csc233/csc233-python-syllabus.html http://hebb.cis.uoguelph.ca/~dbm/teaching/CIS2450/ good luck, and let me know how it goes! -wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Silicon Valley-SF Bay Area Python users group: http://baypiggies.org "Core Python Programming", Prentice Hall PTR, December 2000 http://starship.python.net/crew/wesc/cpp/ wesley.j.chun :: wesc@baypiggies.org cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/
participants (6)
-
Jonathan Pennington
-
Kirby Urner
-
Mats Wichmann
-
Robert Rickenbrode II
-
Timothy Wilson
-
Wesley Chun