Python For Kids For Dummies. Scott Brendan
Чтение книги онлайн.

Читать онлайн книгу Python For Kids For Dummies - Scott Brendan страница 4

СКАЧАТЬ already written code to do it or to help you do it yourself.

Understanding This Book’s Pedagogical Approach

      That title is just to impress your parents. (I hope they’re not reading this part. But look: If they don’t see that title, tell them that this book has a pedagogical approach – ped-uh-goj-i-cul. It means education or teaching.)

      The point of this book is to give you a chunk of information about the programming concepts that you need to program in Python. The book is for you – a kid who can learn Python.

      I am thorough

      Thorough, yes. Will I include everything? No way. Many aspects of Python have lots of options. If I took you through all the possibilities of each option, you’d fall asleep (or throw this book out the window). If you do either of those things, then you won’t be learning.

      As you read, remember that I’ve tried to introduce you to enough information so you can be a Python programmer, but not so much that you’d need superhuman powers to get through it. Expand on your own using the documentation and help.

      You start pretty slowly with core (main) principles. If you think things aren’t going fast enough, skip ahead! The examples are generally self contained. This means that you end up with many smaller projects rather than a few larger projects. I did that on purpose so you can do the projects in any order you like. You’ve got enough people telling you what to do. You can go where you want to in this book.

      The earlier projects use plain English, rather than technical words. As you go through the book, you’ll see more jargon. You’ll also get less hand holding. You’ll have to work harder the further you get through the book.

If you’re dying to know more

      If you really want to know everything about one particular part of Python, first try Python’s help function, its introspection features, and its online documentation. Each of these is introduced later in this project. You can also try some of the reference manuals. They’re different from instructional books (which is what this is). This book: filled with wildly interesting information and humor. Reference manuals: filled with boring (but useful and sometimes important) details. You can also try one of the Python cookbooks (a book with coding recipes that solve specific problems).

      I walk you through programming

      The projects try to show you realistic programming without boring you to tears. When you write your own code to solve your own problems, you’ll need methods and approaches (tools) that get the job done. I teach you these tools by walking you through each project, step by step. Try every step – don’t skip any.

      If you want to run the working program, skip to the end of the project and cut and paste. If you want to learn Python, then consider each project a journey, not a destination. Work through the projects with me and type them in yourself.

      I am practical

      Hopefully, you can use these projects for something in your everyday life. Maybe they’ll help with your homework or let you store private notes. I start small and dream big. Please dream big with me while you’re getting the concepts in the first projects.

Why this book uses Python 2.7

      The Python language is changing from Python 2.7 (sometimes called Python 2) to a new version, called Python 3. This change is taking years to complete. Python 3 is very similar to Python 2, but the two are incompatible – they don’t work together. If you write a script that works in Python 2, it isn’t guaranteed to work in Python 3 (and vice versa).

      Deciding whether to use Python 2 or Python 3 in this book was difficult. I focus on Python 2 (specifically Python 2.7) mainly because I think it still has the best third-party libraries. For example, the Minecraft Pi project at www.dummies.com/go/pythonforkids needs Python 2. If you want to do something productive using Python, and you need to use a third-party module to do it, you’ll probably need Python 2. Third-party modules that work with Python 3 often have a version that works with Python 2 support, but the reverse isn’t true. This will change over the next couple of years.

      The way Python 3 is different from Python 2 is mainly in advanced features. Because of that, even if I based the book on Python 3, I wouldn’t cover most of what’s new about Python 3.

      Finally, Python 2 is part of the standard install on Mac OSX computers, which means that this book should be usable by Mac owners without your having to download and install anything. Most Linux comes with Python installed (but make sure you have Python version 2.7).

Install Python on Mac OSX

      To find and start Python on Mac OSX computers, follow these steps:

      1. Press Cmd+spacebar to open Spotlight.

      2. Type the word terminal.

      Or, from the Finder, select Finder ⇒ Go ⇒ Utilities ⇒ Terminal.

      The Terminal window opens.

      3. In the terminal, type python.

      The Python interpreter that’s built in to Mac OSX opens.

Install Python on Windows

      Unfortunately, Python doesn’t come on Windows. If you’re running Windows, then you need to download and install Python by following the instructions here. Installing Python on Windows isn’t difficult. If you can download a file from a website, you have the skills to install Python.

      Fortunately, the Python Foundation (the peeps who guide the development of Python) makes installable files available from its website.

      When I did the installation, I found that Firefox and Internet Explorer responded differently to the Python download website, so the instructions are based on which of these browsers to use. If you use a whole other browser altogether, try the Internet Explorer instructions.

      With Firefox

      To install Python on a Windows machine with Firefox, follow these steps:

      1. Visit www.python.org/downloads.

      2. Click the button that says Download Python 2.7.9.

      Or, if it’s there, click a more recent version number that starts with 2.7.

Clicking this button automatically downloads and saves an msi file for you. If not, try the instructions for Internet Explorer. See Figure 1-1.

      3. When the download’s complete, click the icon for Firefox’s download tool.

      4. Click the file called python-2.7.9.msi (or the more recent version, if you downloaded one).

      Python 2.7.9 installs on your computer.

       Figure 1-1: Download Python with Firefox.

      With Internet Explorer

      To install Python on a Windows machine with Internet Explorer, follow these steps:

      1. Visit www.python.org/downloads.

      2. СКАЧАТЬ