Programming Tutorial for absolute beginners

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Duncan Smith

    #16
    Re: Programming Tutorial for absolute beginners

    James wrote:[color=blue]
    > Perhaps use the phrase "whole number" there and mention that in
    > programming they're called integers. Having a glossary with
    > definitions for things like integer, float etc etc. would be good if
    > when you talked about integers it linked to the glossary. And
    > similarly use "decimals" for floats? Less sure about that one though.
    > But anyway you don't need to go into the whole type thing, just
    > mention that Python distinguishes between doing maths with whole
    > numbers and decimals.
    >[/color]

    In general they are integers, and "integer" is not a Python type, so I
    don't see a problem with the term. The problem I saw was that there was
    no explanation for the returned value. Using the term "decimal" is
    probably a bad idea, given Python decimals. But I'm not sure you need
    to come up with a suitable term until you actually get round to
    explaining types (at which point the problem disappears).

    Duncan

    Comment

    • Clodoaldo Pinto

      #17
      Re: Programming Tutorial for absolute beginners

      John Salerno wrote:[color=blue]
      > Clodoaldo Pinto wrote:
      >[color=green]
      > > "Python is a remarkably powerful dynamic programming language that is
      > > used in a wide variety of application domains. Python is often compared
      > > to Tcl, Perl, Ruby, Scheme or Java. Some of its key distinguishing
      > > features include:..."[/color]
      >
      > I'd be careful with that definition for newbies though. There's nothing
      > more frustrating (as a newbie myself) when Python (or anything else) is
      > compared to something as a way to explain it, yet I have no idea what
      > the other things are either! A programming newbie won't know about, and
      > maybe won't even have heard of, those other languages.[/color]

      Good point. I used the Python site front page definition without the
      object oriented thing.

      Regars, Clodoaldo

      Comment

      • James

        #18
        Re: Programming Tutorial for absolute beginners

        If you're serious about this being a real introduction for someone who
        knows nothing, then you might want to start off by explaining what a
        programming language is (and why there are more than one) and then
        what a standard library is - perhaps explain it in terms of a large
        set of tools you can use straight away?

        James

        On 8 Apr 2006 11:53:34 -0700, Clodoaldo Pinto <clodoaldo.pint o@gmail.com> wrote:[color=blue]
        > John Salerno wrote:[color=green]
        > > Clodoaldo Pinto wrote:
        > >[color=darkred]
        > > > "Python is a remarkably powerful dynamic programming language that is
        > > > used in a wide variety of application domains. Python is often compared
        > > > to Tcl, Perl, Ruby, Scheme or Java. Some of its key distinguishing
        > > > features include:..."[/color]
        > >
        > > I'd be careful with that definition for newbies though. There's nothing
        > > more frustrating (as a newbie myself) when Python (or anything else) is
        > > compared to something as a way to explain it, yet I have no idea what
        > > the other things are either! A programming newbie won't know about, and
        > > maybe won't even have heard of, those other languages.[/color]
        >
        > Good point. I used the Python site front page definition without the
        > object oriented thing.
        >
        > Regars, Clodoaldo
        >
        > --
        > http://mail.python.org/mailman/listinfo/python-list
        >[/color]

        Comment

        • Clodoaldo Pinto

          #19
          Re: Programming Tutorial for absolute beginners

          Duncan Smith wrote:[color=blue]
          > James wrote:[color=green]
          > > Perhaps use the phrase "whole number" there and mention that in
          > > programming they're called integers. Having a glossary with
          > > definitions for things like integer, float etc etc. would be good if
          > > when you talked about integers it linked to the glossary. And
          > > similarly use "decimals" for floats? Less sure about that one though.
          > > But anyway you don't need to go into the whole type thing, just
          > > mention that Python distinguishes between doing maths with whole
          > > numbers and decimals.
          > >[/color]
          >
          > In general they are integers, and "integer" is not a Python type, so I
          > don't see a problem with the term. The problem I saw was that there was
          > no explanation for the returned value.[/color]

          How would I explain that 3 / 2 is 1 without entering the type realm?
          What if I say that if one don't use the point the interpreter will also
          not use it? Would i be laying? Isn't it better to just let it go? I
          think the typical non programmer newbie just don't care two much about
          reasons as long as there is a clear rule. No point in the question then
          no point in the answer.
          [color=blue]
          > Using the term "decimal" is
          > probably a bad idea, given Python decimals. But I'm not sure you need
          > to come up with a suitable term until you actually get round to
          > explaining types (at which point the problem disappears).
          >[/color]

          As I think float is scaring I changed it in the program comments where
          it appeared for decimal. I don't worry about precision as much as I
          worry about fluidity. I don't want anyone stoping to consult a
          dictionary or a glossary.

          Now the integer versus whole. As a non native english speaker I don't
          know what sounds less mathematical and more natural. I changed integer
          to whole following the previous suggestion but I really don't know.

          Regards, Clodoaldo

          Comment

          • Duncan Smith

            #20
            Re: Programming Tutorial for absolute beginners

            Clodoaldo Pinto wrote:[color=blue]
            > Duncan Smith wrote:
            >[color=green]
            >>James wrote:
            >>[color=darkred]
            >>>Perhaps use the phrase "whole number" there and mention that in
            >>>programmin g they're called integers. Having a glossary with
            >>>definition s for things like integer, float etc etc. would be good if
            >>>when you talked about integers it linked to the glossary. And
            >>>similarly use "decimals" for floats? Less sure about that one though.
            >>>But anyway you don't need to go into the whole type thing, just
            >>>mention that Python distinguishes between doing maths with whole
            >>>numbers and decimals.
            >>>[/color]
            >>
            >>In general they are integers, and "integer" is not a Python type, so I
            >>don't see a problem with the term. The problem I saw was that there was
            >>no explanation for the returned value.[/color]
            >
            >
            > How would I explain that 3 / 2 is 1 without entering the type realm?[/color]

            Well you said something like "it returns an integer" without explaining
            why the returned integer was 1 rather than, say, 10. So you probably
            need to explain what integer division is, e.g.
            http://mathworld.wolfram.com/IntegerDivision.html.
            [color=blue]
            > What if I say that if one don't use the point the interpreter will also
            > not use it? Would i be laying? Isn't it better to just let it go?[/color]

            I reckon letting it go would lead to confusion. If I didn't know
            already, I'd want to know why it returned 1. You can explain that
            without referring to types, but just saying e.g. that ordinary division
            is performed if the numerator or denominator is followed by a decimal point.

            But as you use conversions to float in order to avoid integer division
            in your code examples, it might be best to explain what's going on, even
            if you do have to explain the relevant types.

            I[color=blue]
            > think the typical non programmer newbie just don't care two much about
            > reasons as long as there is a clear rule. No point in the question then
            > no point in the answer.
            >[/color]

            I can't imagine anyone (who doesn't already know) looking at the example
            and not wondering why it returned 1 rather than something else.
            [color=blue]
            >[color=green]
            >> Using the term "decimal" is
            >>probably a bad idea, given Python decimals. But I'm not sure you need
            >>to come up with a suitable term until you actually get round to
            >>explaining types (at which point the problem disappears).
            >>[/color]
            >
            >
            > As I think float is scaring I changed it in the program comments where
            > it appeared for decimal. I don't worry about precision as much as I
            > worry about fluidity. I don't want anyone stoping to consult a
            > dictionary or a glossary.
            >
            > Now the integer versus whole. As a non native english speaker I don't
            > know what sounds less mathematical and more natural. I changed integer
            > to whole following the previous suggestion but I really don't know.
            >[/color]

            Integer is more mathematical, and more precise. I just looked up some
            definitions for "whole number", and found it can apparently mean
            positive integer, non-negative integer, or integer. Maybe you can use
            integer and just put "whole number" in brackets after it, the first time
            you use it; as a vague definition? But describing the relevant types
            and integer division might make your later examples clearer.

            Duncan

            Comment

            • Frank Millman

              #21
              Re: Programming Tutorial for absolute beginners


              Clodoaldo Pinto wrote:[color=blue]
              > James wrote:[color=green]
              > > On the calculator page you describe the difference between 3.0 / 2 and
              > > 3 / 2, but an absolute beginner probably wouldn't know about the
              > > difference between integers and floats, or even what the two terms
              > > meant. If you don't know much about computers then the fact that they
              > > are separate types would probably be surprising...
              > >[/color]
              > This point is not easy to aproach. The fact is that it is necessary
              > that the beginner knows that there is a differerence between 3 / 2 and
              > 3.0 / 2.
              >
              > I don't want him to now about types, at least not at that stage. I used
              > the term "integer" for the lack of a better one and I didn't mention
              > "float". Any suggestions?
              >
              > Regards, Clodoaldo.[/color]

              Here is a idea. I am not sure if it is a good idea, but you can compare
              it with the other suggestions for resolving this dilemma.

              We know that Python is in the process of changing the division
              operator. The main reason for the change is that the current approach
              is not intuitive to a newcomer (whether experienced or not).

              Why not think to the future, and do it like this. Instruct the reader
              to enter 'from __future__ import division'. You do not have to explain
              the details, just say that this is the way division will work in the
              future, and this statement will eventually not be required.

              Then your example will show that 3/2 = 1.5, which is what they would
              expect.

              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.

              My 2c

              Frank Millman

              Comment

              • Clodoaldo Pinto

                #22
                Re: Programming Tutorial for absolute beginners

                Duncan Smith wrote:[color=blue]
                >
                > But as you use conversions to float in order to avoid integer division
                > in your code examples, it might be best to explain what's going on, even
                > if you do have to explain the relevant types.
                >[/color]

                I changed the comments in the first program that uses float() to:

                # The raw_input() function asks the user for a text
                # As a text can't be multiplied or divided the
                # float() function tranforms the text into a decimal number

                [color=blue]
                >
                > I can't imagine anyone (who doesn't already know) looking at the example
                > and not wondering why it returned 1 rather than something else.
                >[/color]
                ....[color=blue]
                >
                > Integer is more mathematical, and more precise. I just looked up some
                > definitions for "whole number", and found it can apparently mean
                > positive integer, non-negative integer, or integer. Maybe you can use
                > integer and just put "whole number" in brackets after it, the first time
                > you use it; as a vague definition? But describing the relevant types
                > and integer division might make your later examples clearer.
                >[/color]

                Now it says "integer (whole number)" followed by a link to a forum post
                where this issue can be discussed.


                Regards, Clodoaldo

                Comment

                • Clodoaldo Pinto

                  #23
                  Re: Programming Tutorial for absolute beginners

                  Frank Millman wrote:[color=blue]
                  >
                  > We know that Python is in the process of changing the division
                  > operator. The main reason for the change is that the current approach
                  > is not intuitive to a newcomer (whether experienced or not).
                  >
                  > Why not think to the future, and do it like this. Instruct the reader
                  > to enter 'from __future__ import division'. You do not have to explain
                  > the details, just say that this is the way division will work in the
                  > future, and this statement will eventually not be required.
                  >
                  > Then your example will show that 3/2 = 1.5, which is what they would
                  > expect.
                  >
                  > 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.
                  >[/color]
                  I included your suggestion in the forum topic that is linked from the
                  division paragraph:


                  Comment

                  • John Salerno

                    #24
                    Re: Programming Tutorial for absolute beginners

                    Clodoaldo Pinto wrote:[color=blue]
                    > Duncan Smith wrote:[color=green]
                    >> But as you use conversions to float in order to avoid integer division
                    >> in your code examples, it might be best to explain what's going on, even
                    >> if you do have to explain the relevant types.
                    >>[/color]
                    >
                    > I changed the comments in the first program that uses float() to:
                    >
                    > # The raw_input() function asks the user for a text
                    > # As a text can't be multiplied or divided the
                    > # float() function tranforms the text into a decimal number[/color]

                    Hmmm, maybe a picky point for a newbie, but since there actually is a
                    decimal module now, you might want to change the description of float().

                    Comment

                    • Marc 'BlackJack' Rintsch

                      #25
                      Re: Programming Tutorial for absolute beginners

                      In <1144572585.147 756.144240@i40g 2000cwc.googleg roups.com>, Frank Millman
                      wrote:
                      [color=blue]
                      > Why not think to the future, and do it like this. Instruct the reader
                      > to enter 'from __future__ import division'. You do not have to explain
                      > the details, just say that this is the way division will work in the
                      > future, and this statement will eventually not be required.
                      >
                      > Then your example will show that 3/2 = 1.5, which is what they would
                      > expect.
                      >
                      > 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.[/color]

                      Or instead of converting the `float` back to an `int`, they can use
                      integer division: ``3 // 2``

                      Ciao,
                      Marc 'BlackJack' Rintsch

                      Comment

                      • Frank Millman

                        #26
                        Re: Programming Tutorial for absolute beginners


                        Marc 'BlackJack' Rintsch wrote:[color=blue]
                        > In <1144572585.147 756.144240@i40g 2000cwc.googleg roups.com>, Frank Millman
                        > wrote:
                        >[color=green]
                        > > 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.[/color]
                        >
                        > Or instead of converting the `float` back to an `int`, they can use
                        > integer division: ``3 // 2``
                        >[/color]

                        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

                        Comment

                        • Clodoaldo Pinto

                          #27
                          Re: Programming Tutorial for absolute beginners

                          Frank Millman wrote:[color=blue]
                          > Marc 'BlackJack' Rintsch wrote:[color=green]
                          > > In <1144572585.147 756.144240@i40g 2000cwc.googleg roups.com>, Frank Millman
                          > > wrote:
                          > >[color=darkred]
                          > > > 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.[/color]
                          > >
                          > > Or instead of converting the `float` back to an `int`, they can use
                          > > integer division: ``3 // 2``
                          > >[/color]
                          >
                          > 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.[/color]

                          Right !!
                          [color=blue]
                          >
                          > 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.[/color]

                          Right again !!

                          Although the Python way is almost always easy to learn I won't be
                          pythonic (as in specific to Python) where it won't help.

                          Regards, Clodoaldo

                          Comment

                          Working...