Programming Tutorial for absolute beginners

Frank Millman frank at chagford.com
Tue Apr 11 01:42:24 EDT 2006


Marc 'BlackJack' Rintsch wrote:
> In <1144572585.147756.144240 at i40g2000cwc.googlegroups.com>, Frank Millman
> wrote:
>
> > Then you can mention that, if they just want the integer portion, they
> > can use int(3/2). I think that most people with the slightest
> > understanding of basic arithmetic will relate to this without a
> > problem.
>
> Or instead of converting the `float` back to an `int`, they can use
> integer division:  ``3 // 2``
>

I had thought of that. The reason I did not suggest it is that, as I
understand it, this tutorial is not about how to learn Python, it is
about teaching programming to the absolute beginner.

I imagine (hope I am not making invalid assumptions here) that Python
was chosen as a base because it is easy and intuitive to learn, and in
most cases it is. It just happens that division is one area where it is
a bit awkward.

The // syntax is specific to Python. I don't think you are helping the
absolute beginner by forcing them to understand what is going on here.
On the other hand, int(x) is a basic mathematical concept (extract the
portion to the left of the decimal point) that is shared by several
languages and is fairly easy to understand.

My 2c (I am up to 4c now)

Frank




More information about the Python-list mailing list