Python projects for CS1

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Python projects for CS1

punch-2
Given all the discussion about exercises, we though we'd throw in some of the work we've done. MSU has taught its CS1 course in Python since the Fall of 2007. Each semester we have the students complete 11 programming projects (as homework). The homeworks start out easy and work their way up. Each project focuses on a particular topic i.e., strings, working with files, dictionaries etc.

We've collected those projects on a webpage. Each project has some supporting material and a solution. However, at the moment the solution is not shown. We are working on that.

Some of the projects ended up in the book we recently published ("Practice of Computing Using Python", Punch, Enbody) but there are over 58 listed here (and more coming) so there is a lot more listed on the web page

http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/index.php

If you have any comments, we'd love to hear them.
-- 


        >>>bill<<<


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

David MacQuigg
Hello Bill,

Your contributions of exercises for PyKata are welcome.  At the moment,
we are classifying exercises with simple keywords: (lists, strings,
logic) etc.   Later we plan to have the website customizable for
teachers like yourself who have not just a few exercises, but an entire
course optimized for a particular group of students.  When a student
visits pykata.org/~punch, they will see just the problems you have selected.

Looks like we are getting good response to Andy's solicitation for a
Google Summer of Code project finishing our website development.  I'm
confident we will have this website fully developed by the end of the
summer.  Our key advantage is open-source teamwork.  That should provide
us with plenty of content, covering every educational need from junior
high to graduate classes in engineering.

-- Dave

************************************************************     *
* David MacQuigg, PhD    email: macquigg at ece.arizona.edu   *  *
* Research Associate                phone: USA 520-721-4583   *  *  *
* ECE Department, University of Arizona                       *  *  *
*                                 9320 East Mikelyn Lane       * * *
* http://purl.net/macquigg        Tucson, Arizona 85710          *
************************************************************     *




Bill Punch wrote:

> Given all the discussion about exercises, we though we'd throw in some
> of the work we've done. MSU has taught its CS1 course in Python since
> the Fall of 2007. Each semester we have the students complete 11
> programming projects (as homework). The homeworks start out easy and
> work their way up. Each project focuses on a particular topic i.e.,
> strings, working with files, dictionaries etc.
>
> We've collected those projects on a webpage. Each project has some
> supporting material and a solution. However, at the moment the
> solution is not shown. We are working on that.
>
> Some of the projects ended up in the book we recently published
> ("Practice of Computing Using Python", Punch, Enbody) but there are
> over 58 listed here (and more coming) so there is a lot more listed on
> the web page
>
> http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/index.php
>
> If you have any comments, we'd love to hear them.
> --
>
>
>         >>>bill<<<
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>  


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

Vern Ceder
In reply to this post by punch-2
Bill,

This is a great collection!

I do have one question, one that actually applies to PyKata and
Codingbat as well... what license governs this material?

Can it be "remixed" and/or republished?

Thanks,
Vern



Bill Punch wrote:

> Given all the discussion about exercises, we though we'd throw in some
> of the work we've done. MSU has taught its CS1 course in Python since
> the Fall of 2007. Each semester we have the students complete 11
> programming projects (as homework). The homeworks start out easy and
> work their way up. Each project focuses on a particular topic i.e.,
> strings, working with files, dictionaries etc.
>
> We've collected those projects on a webpage. Each project has some
> supporting material and a solution. However, at the moment the solution
> is not shown. We are working on that.
>
> Some of the projects ended up in the book we recently published
> ("Practice of Computing Using Python", Punch, Enbody) but there are over
> 58 listed here (and more coming) so there is a lot more listed on the
> web page
>
> http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/index.php
>
> If you have any comments, we'd love to hear them.
>
> --
>
>
>         >>>bill<<<
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig

--
This time for sure!
    -Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
[hidden email]; 260-436-0746; FAX: 260-436-5137

The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

punch-2
You know, that is a great question (and one we forgot to address). We
just added a Creative Commons license to the bottom (share and  share
alike). That seems like what we were shooting for.

Thanks Vern.

        >>>bill<<<



Vern Ceder wrote:

> Bill,
>
> This is a great collection!
>
> I do have one question, one that actually applies to PyKata and
> Codingbat as well... what license governs this material?
>
> Can it be "remixed" and/or republished?
>
> Thanks,
> Vern
>
>
>
> Bill Punch wrote:
>> Given all the discussion about exercises, we though we'd throw in
>> some of the work we've done. MSU has taught its CS1 course in Python
>> since the Fall of 2007. Each semester we have the students complete
>> 11 programming projects (as homework). The homeworks start out easy
>> and work their way up. Each project focuses on a particular topic
>> i.e., strings, working with files, dictionaries etc.
>>
>> We've collected those projects on a webpage. Each project has some
>> supporting material and a solution. However, at the moment the
>> solution is not shown. We are working on that.
>>
>> Some of the projects ended up in the book we recently published
>> ("Practice of Computing Using Python", Punch, Enbody) but there are
>> over 58 listed here (and more coming) so there is a lot more listed
>> on the web page
>>
>> http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/index.php
>>
>> If you have any comments, we'd love to hear them.
>>
>> --
>>
>>
>>         >>>bill<<<
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Edu-sig mailing list
>> [hidden email]
>> http://mail.python.org/mailman/listinfo/edu-sig
>
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

Vern Ceder
Thanks addressing that so quickly, Bill.

Now IMHO it's an even better collection! :)

Cheers,
Vern

Bill Punch wrote:

> You know, that is a great question (and one we forgot to address). We
> just added a Creative Commons license to the bottom (share and  share
> alike). That seems like what we were shooting for.
>
> Thanks Vern.
>
>        >>>bill<<<
>
>
>
> Vern Ceder wrote:
>> Bill,
>>
>> This is a great collection!
>>
>> I do have one question, one that actually applies to PyKata and
>> Codingbat as well... what license governs this material?
>>
>> Can it be "remixed" and/or republished?
>>
>> Thanks,
>> Vern
>>
>>
>>
>> Bill Punch wrote:
>>> Given all the discussion about exercises, we though we'd throw in
>>> some of the work we've done. MSU has taught its CS1 course in Python
>>> since the Fall of 2007. Each semester we have the students complete
>>> 11 programming projects (as homework). The homeworks start out easy
>>> and work their way up. Each project focuses on a particular topic
>>> i.e., strings, working with files, dictionaries etc.
>>>
>>> We've collected those projects on a webpage. Each project has some
>>> supporting material and a solution. However, at the moment the
>>> solution is not shown. We are working on that.
>>>
>>> Some of the projects ended up in the book we recently published
>>> ("Practice of Computing Using Python", Punch, Enbody) but there are
>>> over 58 listed here (and more coming) so there is a lot more listed
>>> on the web page
>>>
>>> http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/index.php
>>>
>>> If you have any comments, we'd love to hear them.
>>>
>>> --
>>>
>>>
>>>         >>>bill<<<
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Edu-sig mailing list
>>> [hidden email]
>>> http://mail.python.org/mailman/listinfo/edu-sig
>>

--
This time for sure!
    -Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
[hidden email]; 260-436-0746; FAX: 260-436-5137

The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

Phil Wagner-2
In reply to this post by punch-2
This is so perfect for what I am trying to do in my math class. I also appreciate the format. It is very clear and should be perfect for students.

Thank you so much for sharing!

Phil

--
http://www.google.com/profiles/philhwagner
http://staff.hthcv.hightechhigh.org/~pwagner/ (My Digital Portfolio)

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

kirby urner-4
In reply to this post by punch-2
On Tue, Mar 23, 2010 at 7:29 AM, Bill Punch <[hidden email]> wrote:

<< snip >>

> If you have any comments, we'd love to hear them.
>


Hi Bill --

I enjoyed poking through some of these, reminiscent of some of the
SuperQuest challenges for Oregon's annual software competition,
high school students working in teams, with a language of their
choice, to come up with a working solution in a time race.

I like how you cover a lot of territory.  Just looking at your page
reassures a student that computer programs are ubiquitous i.e.
in all walks a life (or a lot of 'em).  Teachers should feel heartened
as well, especially math teachers, seeking new relevance
amidst real world topics, like strangers in a strange land
(some of them).

I'm wondering if you sometimes revisit the same problem suggesting
different strategies for solution, perhaps after students have struggled
and turned in some work.  The same problem tackled multiple times
may help boost student self-confidence, as they perceive how their
powers are growing (like working out in a gym, lifting that same stack
more easily).

For example, the Caesar Code stuff is pretty interesting, as a generic
introduction to permutations, wherein rotations might be "multiplied".
You've got finite groups going here -- a topic I try to import from the
college math world, much of which hides behind "calculus mountain",
a killer peak most have to climb before they're even told "abstract
algebra" exists.  Yet so much fun could be had, so much cavorting,
if we could just play with "math objects" that play in groups.

http://www.4dsolutions.net/ocn/flash/group.html  (annoying noise!)

Another definition of a Caesar Code (Nero Code?  Hadrian Code?)
allows these codes to be completely random, though still one-to-one
of course, and includes the space character as another one to
encode, makes it all seem the more cryptic cuz of the wrecked
word boundaries.

So what if a student hasn't used dictionaries yet, or has only just
discovered them, and sticks with indexed strings, as your hints
suggest.  Coming back to the same problem later, newly armed
with a dictionary, list comprehensions, maybe the whole exercise
seems easier and more concise?  Don't wanna get *too* concise.

Example

IDLE 2.6.4

>>> from string import lowercase as lowers; from random import shuffle

Get lowercase a-z plus space character

>>> thechars = lowers[:26]+" "

>>> def makekey(instring):
        thecopy = list(instring)
        shuffle(thecopy)
        return dict(zip(list(instring), thecopy))

Build the secret key with thechars, get back a dictionary:

>>> coding = makekey(thechars)

>>> coding
{' ': 'g', 'a': 'x', 'c': 'w', 'b': 'c', 'e': 't', 'd': 'n', 'g': 'h',
'f': 'm', 'i': 'j', 'h': 'k', 'k': 'a', 'j': 'o', 'm': 's', 'l': 'u',
'o': 'p', 'n': 'l', 'q': 'y', 'p': 'z', 's': 'f', 'r': 'b', 'u': 'q',
't': 'i', 'w': 'e', 'v': ' ', 'y': 'r', 'x': 'd', 'z': 'v'}

Define encoding and decoding functions, then test them.  Pass through
any letters not in the key:

>>> def encode(phrase, secretkey):
        output = ''
        for char in phrase:
                output += secretkey.get(char, char)
        return output

>>> def decode(phrase, secretkey):
        output = ""
        reverselookup = dict((value, key) for key,value in secretkey.items())
        for char in phrase:
                output += reverselookup.get(char, char)
        return output

>>> p = "Able was I ere I saw Elba"

>>> e = encode(p, coding)
>>> e
'AejlgfwtgIglclgIgtwfgEjew'

>>> decode(e, coding)
'Able was I ere I say Elba'

My propensity, coming from a math teaching perspective, is to look
at a Python module as a "fish tank" with multiple mouths to feed,
i.e. I like to publish a simple API and feed arguments to functions
(other denizens) directly, sans raw_input prompts.

This more directly corresponds to the idea of a grab bag of tools,
a library, whereas a raw_input cycle more corresponds to polling
in a GUI, staying alert for user inputs.

Both modalities make a lot of sense, so I'm not saying I wouldn't
go with raw_input sometimes -- I know students like being prompted,
even by their own code.

Sometimes I even use text menus with switching. :)
http://www.4dsolutions.net/ocn/pymath.html  (example at the end).

Didn't see whether some of your challenges drop the raw_input
to seem more like libraries, or whether you ask for a menu.  Another
thing is to ask for command line arguments and use sys.args
-- so much fun, we might have, eh?

Anyway, we're all aware of these possibilities -- just thought I'd
remind myself of some of them.

Again:  reassuring to see the broad-based examples.

Hitting the same challenge multiple times, but with new tools
and/or concepts each time, is what many teachers call
"spiraling" as you likely know.

Pre-written code may be called "scaffolding" if you wanna
sound like you know the shoptalk.

In the high school math teaching world, John Saxon is often
cited for making especially strategic use of "spiraling"
although his detractors would consider this unmerited
crediting of an interloper (something of a maverick that
guy -- never met him).

I mention all this by way of background, in that I cite him
in my Notes for Teachers for Pycon 2009 re spiraling FYI:

http://www.4dsolutions.net/presentations/py4t_notes.pdf

On another note, thanks to Edward Cherlin (and Maria too)
for jumping in on math-thinking-l this month.  That's a
functional programmers' hangout and any incursion of
"imperative programmers" tends to generate some ire
-- kinda like West Side Story?  In the old days, we'd
find some eligible prince or princess to marry into the
Great Lambda tribe (as in lambda calculus).

I've been bugging philosophers to devote some bandwidth
to this feuding but they're busy with paper and pencil logic,
can't be bothered with "CS" apparently.

Maybe I'm being overly judgmental, and anyway it's not like
there's anything much at stake.  Or is there? -- math teachers
like Maria get caught in the cross-fire, Gary too for that
matter, though he seems to hold his own.  Maybe the
floodgates would open for more funding of discrete maths
at the high school level, if only the engineers weren't seen
to be fighting amongst themselves so much?  Nothing scares
away wannabe investor-sponsors so much as feuding and
acrimony eh?

Speaking of Gary (Litvin), he got the ball rolling by commenting
on corestandards.org, a K-12 standards-building initiative
purportedly with real state governors on board.  He sees signs
that discrete math topics are losing ground, not gaining it.
But that's perhaps more testament to an unimaginative
and uninformed bureaucracy that has yet to achieve
a strangle-hold?  One may fondly so hope I suppose. Over
on math-teach, I mention that our Pauling Center has not
been consulted, and we're at the epicenter (evidence that
these bureaucrats have gone way out on a limb?).

http://mathforum.org/kb/message.jspa?messageID=7013136&tstart=0

See math-thinking-l archives if wanting more substance
behind these ramblings (wanderings).

Bill, if you're still with me, I look forward to poking around
in more of your exercises and may well have more to say,
hope OK.

Kirby
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

Mokurai
See also Mr. Babbage's Secret: The Tale of a Cipher--and APL.
Step-by-step through all of the kinds of cipher that Charles Babbage
found in the agony column (Personals) in The Times, and a legal case
where he testified about a cipher he cracked.

On Tue, Mar 23, 2010 at 20:58, kirby urner <[hidden email]> wrote:

> On Tue, Mar 23, 2010 at 7:29 AM, Bill Punch <[hidden email]> wrote:
>
> << snip >>
>
>> If you have any comments, we'd love to hear them.
>>
>
>
> Hi Bill --
>
> I enjoyed poking through some of these, reminiscent of some of the
> SuperQuest challenges for Oregon's annual software competition,
> high school students working in teams, with a language of their
> choice, to come up with a working solution in a time race.
>
> I like how you cover a lot of territory.  Just looking at your page
> reassures a student that computer programs are ubiquitous i.e.
> in all walks a life (or a lot of 'em).  Teachers should feel heartened
> as well, especially math teachers, seeking new relevance
> amidst real world topics, like strangers in a strange land
> (some of them).
>
> I'm wondering if you sometimes revisit the same problem suggesting
> different strategies for solution, perhaps after students have struggled
> and turned in some work.  The same problem tackled multiple times
> may help boost student self-confidence, as they perceive how their
> powers are growing (like working out in a gym, lifting that same stack
> more easily).
>
> For example, the Caesar Code stuff is pretty interesting, as a generic
> introduction to permutations, wherein rotations might be "multiplied".
> You've got finite groups going here -- a topic I try to import from the
> college math world, much of which hides behind "calculus mountain",
> a killer peak most have to climb before they're even told "abstract
> algebra" exists.  Yet so much fun could be had, so much cavorting,
> if we could just play with "math objects" that play in groups.
>
> http://www.4dsolutions.net/ocn/flash/group.html  (annoying noise!)
>
> Another definition of a Caesar Code (Nero Code?  Hadrian Code?)
> allows these codes to be completely random, though still one-to-one
> of course, and includes the space character as another one to
> encode, makes it all seem the more cryptic cuz of the wrecked
> word boundaries.
>
> So what if a student hasn't used dictionaries yet, or has only just
> discovered them, and sticks with indexed strings, as your hints
> suggest.  Coming back to the same problem later, newly armed
> with a dictionary, list comprehensions, maybe the whole exercise
> seems easier and more concise?  Don't wanna get *too* concise.
>
> Example
>
> IDLE 2.6.4
>
>>>> from string import lowercase as lowers; from random import shuffle
>
> Get lowercase a-z plus space character
>
>>>> thechars = lowers[:26]+" "
>
>>>> def makekey(instring):
>        thecopy = list(instring)
>        shuffle(thecopy)
>        return dict(zip(list(instring), thecopy))
>
> Build the secret key with thechars, get back a dictionary:
>
>>>> coding = makekey(thechars)
>
>>>> coding
> {' ': 'g', 'a': 'x', 'c': 'w', 'b': 'c', 'e': 't', 'd': 'n', 'g': 'h',
> 'f': 'm', 'i': 'j', 'h': 'k', 'k': 'a', 'j': 'o', 'm': 's', 'l': 'u',
> 'o': 'p', 'n': 'l', 'q': 'y', 'p': 'z', 's': 'f', 'r': 'b', 'u': 'q',
> 't': 'i', 'w': 'e', 'v': ' ', 'y': 'r', 'x': 'd', 'z': 'v'}
>
> Define encoding and decoding functions, then test them.  Pass through
> any letters not in the key:
>
>>>> def encode(phrase, secretkey):
>        output = ''
>        for char in phrase:
>                output += secretkey.get(char, char)
>        return output
>
>>>> def decode(phrase, secretkey):
>        output = ""
>        reverselookup = dict((value, key) for key,value in secretkey.items())
>        for char in phrase:
>                output += reverselookup.get(char, char)
>        return output
>
>>>> p = "Able was I ere I saw Elba"
>
>>>> e = encode(p, coding)
>>>> e
> 'AejlgfwtgIglclgIgtwfgEjew'
>
>>>> decode(e, coding)
> 'Able was I ere I say Elba'
>
> My propensity, coming from a math teaching perspective, is to look
> at a Python module as a "fish tank" with multiple mouths to feed,
> i.e. I like to publish a simple API and feed arguments to functions
> (other denizens) directly, sans raw_input prompts.
>
> This more directly corresponds to the idea of a grab bag of tools,
> a library, whereas a raw_input cycle more corresponds to polling
> in a GUI, staying alert for user inputs.
>
> Both modalities make a lot of sense, so I'm not saying I wouldn't
> go with raw_input sometimes -- I know students like being prompted,
> even by their own code.
>
> Sometimes I even use text menus with switching. :)
> http://www.4dsolutions.net/ocn/pymath.html  (example at the end).
>
> Didn't see whether some of your challenges drop the raw_input
> to seem more like libraries, or whether you ask for a menu.  Another
> thing is to ask for command line arguments and use sys.args
> -- so much fun, we might have, eh?
>
> Anyway, we're all aware of these possibilities -- just thought I'd
> remind myself of some of them.
>
> Again:  reassuring to see the broad-based examples.
>
> Hitting the same challenge multiple times, but with new tools
> and/or concepts each time, is what many teachers call
> "spiraling" as you likely know.
>
> Pre-written code may be called "scaffolding" if you wanna
> sound like you know the shoptalk.
>
> In the high school math teaching world, John Saxon is often
> cited for making especially strategic use of "spiraling"
> although his detractors would consider this unmerited
> crediting of an interloper (something of a maverick that
> guy -- never met him).
>
> I mention all this by way of background, in that I cite him
> in my Notes for Teachers for Pycon 2009 re spiraling FYI:
>
> http://www.4dsolutions.net/presentations/py4t_notes.pdf
>
> On another note, thanks to Edward Cherlin (and Maria too)
> for jumping in on math-thinking-l this month.  That's a
> functional programmers' hangout and any incursion of
> "imperative programmers" tends to generate some ire
> -- kinda like West Side Story?  In the old days, we'd
> find some eligible prince or princess to marry into the
> Great Lambda tribe (as in lambda calculus).
>
> I've been bugging philosophers to devote some bandwidth
> to this feuding but they're busy with paper and pencil logic,
> can't be bothered with "CS" apparently.
>
> Maybe I'm being overly judgmental, and anyway it's not like
> there's anything much at stake.  Or is there? -- math teachers
> like Maria get caught in the cross-fire, Gary too for that
> matter, though he seems to hold his own.  Maybe the
> floodgates would open for more funding of discrete maths
> at the high school level, if only the engineers weren't seen
> to be fighting amongst themselves so much?  Nothing scares
> away wannabe investor-sponsors so much as feuding and
> acrimony eh?
>
> Speaking of Gary (Litvin), he got the ball rolling by commenting
> on corestandards.org, a K-12 standards-building initiative
> purportedly with real state governors on board.  He sees signs
> that discrete math topics are losing ground, not gaining it.
> But that's perhaps more testament to an unimaginative
> and uninformed bureaucracy that has yet to achieve
> a strangle-hold?  One may fondly so hope I suppose. Over
> on math-teach, I mention that our Pauling Center has not
> been consulted, and we're at the epicenter (evidence that
> these bureaucrats have gone way out on a limb?).
>
> http://mathforum.org/kb/message.jspa?messageID=7013136&tstart=0
>
> See math-thinking-l archives if wanting more substance
> behind these ramblings (wanderings).
>
> Bill, if you're still with me, I look forward to poking around
> in more of your exercises and may well have more to say,
> hope OK.
>
> Kirby
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>



--
Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://www.earthtreasury.org/
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python projects for CS1

kirby urner-4
<< snip >>

Kirby wrote:

>>>>> p = "Able was I ere I saw Elba"
>>
>>>>> e = encode(p, coding)
>>>>> e
>> 'AejlgfwtgIglclgIgtwfgEjew'
>>
>>>>> decode(e, coding)
>> 'Able was I ere I say Elba'
>>

Kirby replies:

First of all:  Happy Ada Lovelace Day!

Secondly:  Yikes!  I see the typo here (quoted above).

My actual IDLE session had some mistakes so when
I built up this posting, I cut and pasted the working bits,
but then kept this early wrong value for the plaintext p.

When p was enciphered / deciphered, it came back right,
i.e. decode(encode( p )) should be the identity function
for arbitrary p.  However, it started out with this 'say'
mutation, instead of 'saw'.  This is a famous palindrome
by the way, not invented by me, and is put into the mouth
of Napoleon Bonaparte for mnemonic purposes.

Anyway, apologies for my sloppiness to future readers
who might stumble on this post.

Just to expand a bit while I'm at it:

Allowing our permutations to be random instead of rotations
clearly makes this a rather large permutation space, so the
kind of brute force code cracking suggested in the exercise
would be harder.

Were MFTDA (Math for the Digital Age) to morph into a
series, with more time given to many of the topics (in addition
to new topics), then the ramp up to RSA could be more
leisurely and include such as the Caesar Codes in more
detail.

Rotations of polyhedra may be described with such mappings,
with starting / ending points of the vertices.  One might think
of two copies of the same polyhedron superimposed, with the
A of one going to the D of the other upon rotation, other
vertexes moving accordingly.  Permutations give a road map
between the different positions, showing what states are but
one hop away (thinking of hypertoons again -- another thread).

Over on math-teach today, I've drawn an analogy between the
digital divide separating traditional math classes from their
more digital counterparts, and the Berlin Wall.  I claim to be
echoing Ronald Reagan in demanding it be torn down.

http://mathforum.org/kb/message.jspa?messageID=7019256&tstart=0
(rather lengthy, might be called a rant).

I actually think just using Python as a calculator might
can take one a long way.  One might be projecting some
spatial geometric relationship, such as an icosahedron
with faces glued to an enclosing octahedron's, lots of
phi relationships to check.  This is exactly what I was
doing yesterday in fact.

Here's an excerpt from my email outbox:

"""
Meant to include this Python excerpt (back of the napkin check on the
length he claims to find):

>>> from math import sqrt as radical
>>> phi = ( 1 + radical(5))/2.
>>> phi
1.618033988749895
>>> phi / radical(2)
1.1441228056353685
>>> phi / radical(2) + radical(2) / 2
1.851229586821916
>>>

...

http://www.rwgrayprojects.com/synergetics/s09/figs/f87242.html
(18.51... == volume of C. in figure)

That length of the octahedron (icosahedron inside) is 1/10 the volume
of the enclosed icosahedron.  Curious.

Just thought I'd mention, given we're on the topic of the icosahedral
hubs in many versions of Flextegrity.
"""

This might be a signature difference between using
Python in a math class versus a computer science class:
math students may make very light use of Python as
a calculator while focusing a lot of attention on problems
that do NOT require much if any programming to solve.

In other words, math students may often use Python
but do little or no programming with it -- not talking about
no programming in the whole course, just saying a whole
hour might go by where you just run Python as a scratch
pad on the side, have no need to compose or run
programs, other than to import from the occasional
library.

More like Sage in some ways, except we may just
get by with IDLE or something similar.

I underline this difference for the sake of teachers who
cringe at the word "programming".  Some people went
into math teaching precisely because they didn't like
doing that, or just see it as adding a lot of overhead.

BTW, I think 3.1.2 is taken a significant step in its
numeric display habits.  The IEEE floating point
specification is not messed with, but repr has a new
set of conventions.  In general, number formatting is
getting more powerful.

When it comes to bulk data, you start to need more
programming just for file i/o, although even here you
might get away with a lot, especially if the module in
question pre-stores the data.

This is the Rich Data Structure idea I was talking about,
i.e. if you want students to have the lat/long for every
major city on Earth, or to have the Periodic Table of
the Elements as a dictionary of Atom objects (however
designed), then just include the bulk data as a part of
the module, already loaded up into these sophisticated
structures.

Or, if you wanna be more ambitious, include a Reader
for grabbing and loading from raw files, either locally
provided or over the wire (having these in addition to
"ready to use" would be most convenient).

I've got lat / long data for some cities at my web site,
along with a sample "capitals of states" quiz in
MySQL and simple Python.

http://www.4dsolutions.net/ocn/geoquiz.html

You'll see if you read my rant that I go on about needing
a school server or rack of servers.  High schools may
not as yet have those, an unhappy truth.  Those that
do, though, will have an easy way to build up their
data stores.  Math students will get to study the source
code, help maintain it -- or do we call them computer
science students?  How much does it really matter?
Geometry + Geography = What?  Discrete math?

>> My propensity, coming from a math teaching perspective, is to look
>> at a Python module as a "fish tank" with multiple mouths to feed,
>> i.e. I like to publish a simple API and feed arguments to functions
>> (other denizens) directly, sans raw_input prompts.
>>

Kirby
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig