Scott Brendan

Python For Kids For Dummies


Скачать книгу

example). Python means you complete and execute (run) your programs faster and that makes programming fun!

       ✓ Python is cross platform. Almost anyone can use it, no matter what computer operating system they have. You can run pretty much any Python program on Windows, Mac, and Linux personal computers and from large servers through to tiny computers like the Raspberry Pi. (A Pi-specific project is waiting at dummies.com/go/pythonforkids for you.) You can even run Python programs on Android and iOS tablets. I even used my Android tablet to code some of the early projects in this book.

       ✓ Python uses dynamic typing for its variables. This may not mean much to you if you’ve never done programming before. Dynamically typed variables make programming easier because they let you just start using a variable, rather than first explaining to the computer what the variable is supposed to be.

       ✓ Python gets lots of help from third-party modules. This means that a lot of other people (third parties) have written libraries. A library is a bunch of code for doing something specific. This makes your work easier because you don’t have to start from scratch every time you write a new program; sometimes you can use the libraries already written. The Minecraft project online uses a third-party library to change a Minecraft game on a Raspberry Pi.

       ✓ Python is free software. This means that the license terms for Python respect your freedom. I think this is pretty important. You can download and run Python without paying any money, and any program that you write with it is yours to use and share any way you want. It also means that the Python source code (the human-readable form of what the computer runs) is available so, when you’re feeling brave enough, you can look at how the Python developers wrote their code. (It’s written in a different programming language, though, d’oh!)

Pythons aren’t just snakes

      The Python programming language is named after a comedy group called Monty Python, not the reptile. Monty Python was active mainly in the 1970s. (40 years ago! Forever and ever, right?) They had a British television show called Monty Python’s Flying Circus and have made lots of movies, the most notable of which is Monty Python and the Holy Grail.

Who’s Using Python

      Python is used just about everywhere.

       ✓ In space: The International Space Station’s Robonaut 2 robot uses Python for its central command system. Python is planned for use in a European mission to Mars in 2020 to collect soil samples.

       ✓ In particle physics laboratories: Python helps understand the data analysis from some atom smashing experiments at the CERN Large Hadron Collider.

       ✓ In astronomy: The MeerKat Radio telescope array (the largest radio telescope in the Southern Hemisphere) uses Python for its control and monitoring systems.

       ✓ In movie studios: Industrial Light and Magic (Star Wars geniuses) uses Python to automate its movie production processes. Side Effects Software’s computer-generated imagery program Houdini uses Python for its programming interface and to script the engine.

       ✓ In games: Activision uses Python for building games, testing, and analyzing stuff. They even use Python to find people cheating by boosting each other.

       ✓ In the music industry: Spotify music streaming service uses Python to send you music.

       ✓ In the video industry: Netflix uses Python to make sure movies play (stream) without stopping. Python is used a lot for YouTube.

       ✓ In Internet search: Google used Python all over in its early development phase.

       ✓ In medicine: The Nodality company uses Python to handle information that they use to search for a cure to cancer.

       ✓ In your OS (admin-ing your datas): Operating systems like Linux and Mac OSX use Python for some of their administrative functions.

       ✓ In your doorbell: Rupa Dachere and Akkana Peck say that you can automate your home with Python, hooking up sensors to your house. With it you can, for example, open and close the curtains or automatically turn on lights when you come in the room.

      I could go on. The point is that Python will apply to whatever you’re interested in, no matter what it is.

Making Things with Python

      You do these things while you work through this book:

       Make a math trainer for practicing your times tables.

       Make a simple encryption (a secret code) program.

       Use Python on a Raspberry Pi to work with and modify your Minecraft world. (See www.dummies.com/go/pythonforkids for that project.)

      When you’ve honed your mad skills and are ready to move on, there’ll be other things you can do:

       Using Tkinter (or other widget sets), you can write user applications that use graphics rather than just text to interact with the user.

       You can extend other programs like Blender (a 3D modeling program), GIMP (a 2D photo-retouching program), and LibreOffice (office programs), among many others by writing custom scripts. I had to fix some 3D models I was making in Blender. It would’ve taken forever to do by hand, so I wrote a Python script to do it quickly.

       You can write games with graphics using Tkinter or the Pygame or Kivy libraries. The games in this book are text only.

       You can use the matplotlib library to draw complex graphs for your math or science courses.

       Using the openCV library, you can experiment with computer vision. People who are into robotics use it to help their robots see and grab things and to avoid obstacles when moving.

      Whatever you want it to do, there’s a good chance someone has 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.