1 Jul 2003 23:50

## Re: finding factorials

```Danny Yoo schrieb:

>
>The conceptual problem you might be running into is seeing '=' and
>thinking it means math equality.  If so, be careful: it's not!
>
>If this is what you're running into when you see something like:
>
>    x = 42
>
>
>then you need to think of it more like
>
>    x <---------------- 42
>
>
>
Hi, Danny!

I have a different model in my mind, when I see something like this.
I think of a name attached to, or pointing to some object. In this case the
object is the number 42. So I think more like

x -----------------> 42

Now, when I see x, I know I have to think of the object behind x,
the object which is named x.

>>> a = 25001
>>> b = a
>>> b is a
1  # (or, in Python 2.3: True)

So this, for me, means: the object named a is the same as the
one named b.

This lets me better understand, what's going on, if I start to change
objects, (which of course is not possible with a number).

I prefer -  from the beginning - to use a model , which I don't need to
change
when new things appear or have to be done.

These are simply two different points of view, I think ...

Best regards,
Gregor

>That is, imagine a big honking arrow that pushes a value into a name,
>
So my big honking arrow pushes a name onto an object (for instance a value)
taking this name off another object, if it incidentally has been
used for one earlier.

Moreover I can easily think of attaching two (or more) names to an object;
much easier than pushing an object (a value) into two (ore more) names

>squeezing out the old value in the process.  The technical term for this
>is "assignment".  Some folks are too dignified to use the big honking
>arrow, and will write it out on paper like this:
>
>    x <- 42
>
>
>And some computer languages do allow this kind of notation, which more
>clearly shows that what we're doing isn't symmetric at all: we're pushing
>stuff from the right hand side into the left hand side.  Unfortunately,
>Python only uses the '=' notation to assign values to variable names, so
>you have to use '=', even though it might look visually disturbing.
>
>I don't know if this is the assignment issue is the thing that you're
>getting caught on, but if so, I hope the explanation helps a little.
>
>
>
>
>
>
>>print result
>>
>># The result is given as 20 which I think is wrong. Is there anything
>># wrong with my mathematical logic or my function?
>>
>>
>
>Math logic.  *grin*
>
>The GCD of 100 and 20 is supposed to be 20. GCD(a,b) is the greatest
>number that will divide both 'a' and 'b' evenly, and 20 fits that criteria
>perfectly.
>
>
>Hope this helps!
>
>
>_______________________________________________
>Tutor maillist  -  Tutor <at> python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
>

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```

Gmane