[Edu-sig] Re: easy for beginners, even children
Terry Hancock
hancock at anansispaceworks.com
Thu Apr 15 02:26:11 EDT 2004
On Wednesday 14 April 2004 05:54 pm, Daniel Ajoy wrote:
> > But why would they say "set 2 equal to 3" if they want
to
> > know "is 2 equal to 3"?
>
> Because 2 = 3 is what they would write on paper.
>
> But I agree that it does not take much brilliance to
> understand that = and == are different things, and when
> to use each one.
Actually there's a very important lesson there. One thing
that takes some appreciation is that programming (well,
procedural programming) is *prescriptive*, not
*descriptive*, which makes it different from, say algebra.
I mean:
x = x + 1
is an extremely common thing to do in programming (so common
we have a shortcut
x += 1
).
But that's obviously a false statement in algebra.
Therefore it's really important to point out that we are
doing two fundamentally different things when we are
*assigning* a value and when we are *testing* a value.
Even if the syntax let us confuse these two operations (as
it could -- Python doesn't really need two different
symbols for these operations since the assignment is
illegal in tests), it's still a good thing to learn.
Algorithms are fundamentally different from equations, and
this is a good place for the student to learn something. A
potential "Aha!" moment, in fact.
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Edu-sig
mailing list