Page 44 -
P. 44

starting to code





            Q:   I’ve never heard of Python. Is it   Q: Will Python run on my phone, just   Q:  So what if we’d left it out?

            popular?                        like Java?
                                                                            A: The computer would have treated the
           A: Python is used in lots of cool places.   A: That really depends on your phone.   input entered by the user of the program as
            Google, Industrial Light & Magic, YouTube,   Python is designed to run on lots of   a letter. If you ask the computer if a letter
            and NASA (to name a few) all use Python.   different technologies and operating   is equal to a number, it gets confused and
            We think they know what they’re doing.  systems. Running your own code on your   tells you it isn’t.
            Q:   So, when I’m done with this   own phone is a very specific requirement,   Q:  Why’s that?
                                            and Java has that pretty well covered at
            book I’ll throw Python away and use   the moment. As a programming technology,
            something else, like C# or Java?  Java was initially designed to run on very   A: Because if the computer thinks that
                                            small devices, so it is no big surprise that
                                            it is a strong and popular choice when it   two pieces of information are of different
           A: Only if you want to. Python might be   comes to telephony.   “types,” it assumes that there’s no way they
            the only programming language you’ll ever                       can be equal.
            need. But, yes, if you want to learn another
            programming language, you can take   Q: Why is the Python IDE called   Q:  So what if I had not typed a
            everything you learn about programming in   IDLE?               number when I was asked for a guess?
            this book and apply it to any other language                    What if I’d just entered my name or
            with the minimum of effort.    A: It’s partly because it sounds like IDE,   something?
                                            but we suspect that it has more to do with
            Q: But a buddy of mine told me I   Eric Idle, one of the founding members of   A: The code would have crashed with an
            should learn Java or C#. Why are you   the Monty Python’s Flying Circus comedy   error. In fact, Python will complain that the
            not using either of these programming   group.                  program crashed with a “ValueError” (more
            languages in this book?                                         on these error messages later in the book).
                                            Q: Come again?!? Monty Python’s
           A: Both Java and C# are great    Flying what?
            programming technologies, but they can be
            difficult to learn, especially when you are  A: Circus. Yes, we know: sounds silly,
            just starting out. This is not the case with   doesn’t it? And, believe us, it is. It’s funny,
            Python.  And, anyway, this is a book that’s   too. The creator of Python, Guido van
            designed to teach you how to program, and   Rossum, is a big Monthy Python fan and
            using Python as your first programming   reportedly watched the show’s reruns
            language will help us to do just that.  while he designed Python. You’ll find lots
                                            of references to Monty Python folklore in
            Q: There seems to be many different   the Python community. Dead parrots are a
            versions of Python. Which should I use?  particular favorite.
                                            Q:

           A: There are two main releases of     What does int(g) mean?
            Python: 2 and 3. This book is based on
            release 3 of the language. Python 3 is the  A: It tells Python to interpret the user’s
            future of the language; any new features   input as a number rather than a letter.
            are guaranteed to be added to release 3   Within programming languages, the number
            of the language, not release 2. Of course,   5 is different than the letter ‘5’.
            like all releases, Python 3 remains a free
            download, which makes it a no-brainer
            when decidiing if you can afford to use it.
                                                                                         you are here 4    9
   39   40   41   42   43   44   45   46   47   48   49