This is admittedly somewhat weird:
http://www.xtranormal.com/watch?s=87117
(a short cartoon, best to let it download to 100% of playback will be choppy).
Michel, not sure what fonts best for Unicode, still learning. Deju
Vu? (a font).
At least with younger kids, I think it works to speak of callables
having "a mouth".
In python( elephant ) it looks like a python object is "eating" an
elephant object.
( ) looks like a pairing lips, thinking of emoticons i.e. "a mouth
turned sideways."
I'…
[View More]m thinking of skits around functions "eating" objects... (having
little skits is a
part of our Monty Python heritage).
Another metaphor is "the castle gates" i.e. arguments show up to be accepted
by a function or other callable. Exceptions get raised.
Lots of skit possibilities around "duck typing" (quack quack).
Watching now: http://www.youtube.com/watch?v=E_kZDvwofHY
Kirby
[View Less]
I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to …
[View More]introduce these topics.
As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study.
Additional suggestions are welcome.
-- Dave
[View Less]
Warren,
Your book looks great! I'd be interested in seeing the rest of it. Yeah,
we ended up discussing how to represent a deck of cards in class as well.
One of the kids got inspired while creating the dice simulation and emailed
me asking how to do something like that. So I was really glad to see this
start growing organically. We haven't discussed classes previously, as that
would REALLY have scared them off, so I just had him continue at the level
of simple lists, thinking of cards as …
[View More]simple ordered pairs:
>>> suits = ['S', 'H', 'D', 'C']
>>> ranks = ['A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K']
>>> deck = [(rank, suit) for suit in suits for rank in ranks]
>>> shuffle(deck)
>>> hand = [deck.pop() for card in range(5)]
He played around with this and really got into it. Good news! It's amazing
how much you can do in a simple interactive way with Python. I mean, this
LOOKS like what you do with a deck! But I did try to sow some seeds by
mentioning how you could accomplish even more by thinking in terms of
functions and classes.
- Michel
On Fri, Feb 6, 2009 at 9:21 AM, Warren Sande <warren.sande(a)rogers.com>wrote:
> Michel,
>
> Sounds like you caught their interest, which is great. I have a chapter on
> probability and simulation in my book, "Hello World! Computer Programming
> for Kids and Other Beginners". It talks about simulating dice, coins, and a
> deck of cards. In the second half of the chapter we make a Crazy Eights
> card game (text-based). I've attached a preview of the chapter if you want
> to have a look. Keep in mind that this is one of the later chapters, and we
> have already covered the basics like loops, lists, objects, etc.
>
> By the way, the book has had some delays in production, but it should be
> out in the next few weeks.
>
> Regards,
> Warren Sande
>
>
> ------------------------------
> *From:* michel paul <mpaul213(a)gmail.com>
> *To:* "edu-sig(a)python.org" <edu-sig(a)python.org>
> *Sent:* Thursday, February 5, 2009 1:34:49 PM
> *Subject:* [Edu-sig] probability & simulation
>
> We began a unit in math called 'Probability and Simulation'. The students
> of course have to solve many typical problems involving dice and coins.
> This provided a perfect opportunity for incorporating Python in a way that
> didn't freak the kids out. Remember, I have been trying to weave Python
> into a math environment where programming is seen as something alien and
> scary. Bizarre. The 'choice' function in the random library provides an
> excellent way to create all kinds of simulations very easily. I used this
> as an example in class:
>
> >>> coin = ['Heads - I win', 'Tails - you lose']
>
> >>> tosses = [choice(coin) for toss in range(1000)]
>
> It was great. Very easy to understand. This combined with the 'count'
> method in a list, and I could go ahead and assign them a little HW project
> to create a frequency table for throwing 2 dice 10,000 times. I told them
> to just experiment, copy and paste their Shell session and email it to me.
> It worked very well. Even a lot of the kids who have been resistant to this
> Python stuff could handle it. Didn't require having to write functions -
> purely interactive.
>
> Then the next day we explored tetrahedral and other kinds of dice.
>
> Very simple, and it seemed to work well. There's a section at the end of
> the chapter that describes creating simulations using BASIC. Ha! We did
> this on the very first day!
>
> - Michel
>
[View Less]
We began a unit in math called 'Probability and Simulation'. The students
of course have to solve many typical problems involving dice and coins.
This provided a perfect opportunity for incorporating Python in a way that
didn't freak the kids out. Remember, I have been trying to weave Python
into a math environment where programming is seen as something alien and
scary. Bizarre. The 'choice' function in the random library provides an
excellent way to create all kinds of simulations very …
[View More]easily. I used this
as an example in class:
>>> coin = ['Heads - I win', 'Tails - you lose']
>>> tosses = [choice(coin) for toss in range(1000)]
It was great. Very easy to understand. This combined with the 'count'
method in a list, and I could go ahead and assign them a little HW project
to create a frequency table for throwing 2 dice 10,000 times. I told them
to just experiment, copy and paste their Shell session and email it to me.
It worked very well. Even a lot of the kids who have been resistant to this
Python stuff could handle it. Didn't require having to write functions -
purely interactive.
Then the next day we explored tetrahedral and other kinds of dice.
Very simple, and it seemed to work well. There's a section at the end of
the chapter that describes creating simulations using BASIC. Ha! We did
this on the very first day!
- Michel
[View Less]