Getting Started

This blog has been running for many years now. In that time, the whole of the Python landscape has changed. The early posts are written using version 2.7 of Python, while more recent ones (2016ff) are written using Python 3. You are going to need a copy of the Python programming language installed on your machine.

That presents two questions – how do I install it, and what version do I install?
The second of these two is easier to answer – install version 2.7 if you want to do the older tutes, install version 3 . If you want to do both, install both! There is a raging debate about whether to learn Python 2.7 or Python 3 at the moment. I think it doesn’t actually matter. While Python 3 is “the future”, you’re going to need to read and understand Python 2.7 code, because it’s most of the code that’s out there. Conversely, new code is going to be increasingly written in Python 3, so if you start with Python 2.7 you’re going to need to learn Python 3. Whichever one you learn, you’re probably going to need to also learn the other, at least for the next couple of years. The good news is that the basics (ie what you’re going to be learning) are almost exactly the same!

Using a Mac

If you are running a Mac, Python 2.7 is already on your computer – this will be enough to learn to program in Python. I suggest start with that and the earlier tutorials on this blog. To find it start a terminal (search for terminal in Spotlight). When you have a terminal started, click in the terminal window and type

python

(and hit the return key) in the terminal when it opens.

If you want to use Python 3, download a universal binary from
https://www.python.org/downloads/mac-osx/

You download a .dmg file (try to choose the most recent one that has a number starting with 3). You will see it on your desktop. Click it to open a folder with a mpkg file – this is the Python installer. Right click it and select “Open With -> Installer App” to run it. You may get a warning from Apple about the file because you didn’t get it from Apple’s store.

When you’ve installed Python 3, you can run it by opening a terminal (search for terminal in Spotlight). When you have a terminal started, click in the terminal window and type

python3

On Linux

Python is probably already installed on your computer. If not, you can install it through the package management system for your distribution. On OpenSuSE try

 zypper install python python-idle
 zypper install python3 python3-idle

(for Python 2.7/Python 3 respectively)

Windows

You will not have Python installed, you will need to install it yourself – from here. As at October 2016 it has two big buttons, one says Download Python 3.5., the other says “Download Python 2.7.”. Click the Python 2.7 version for Python 2.7 or the other one for Python 3. It will download an msi installer for you (on Windows). You may as well install both.

In each of these cases you will probably need the help of an adult to install it for you.

Once you’ve installed

Once Python is installed you need to get to an interactive Python prompt -> this is the >>> you see in the tutorials. This is done by starting a command shell and typing the command python . Again, you may need to get an adult to show you how the first couple of times. Once you have a prompt up you will be able to tell whether you have the right version. When the Python shell starts up it tells you what version is running:

>python
Python 2.7.6 (default, Nov 21 2013, 15:55:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Python comes with its own help service:

>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> 

Wherever you see a code extract, that’s a print out of what I actually typed with my fingers in my Python interpreter. You’re supposed to type it into yours as well (cut and paste is also fine). In some cases if you don’t type it in yourself, you won’t understand what’s going on because the printout doesn’t show that different things are put on the screen at different times. Just type one line at a time and indentation is important. So:

for i in range(5):
   print i

is completely different from:

for i in range(5):
print i
^ note the different indentation here for the print statement.

The precise number of indents is not all that important as long as all indents are consistent. So it doesn’t matter if you can’t count my whitespaces correctly as long as the start of all your code lines up at the same place (for each code block). So, for example, if I’ve got 4 spaces in front of all my indents, if you do 3 or 5 that’s fine, as long as you do the same number for each of them (ie all lines with 3 spaces and not, say, 3 on one line, 5 on another etc).

Now for Something Completely Different:

If you’ve installed python, then click here to start the tutorials. Do this tutorial for why I’ve chosen python.

After that click the links in the sidebar to go to older tutorials (starting in July 2010 and working forward) and catch up.

8 Responses to Getting Started

  1. Pingback: Python for Kids | Facticity

  2. Hey I found this website http://economisteblog.com to be actually fascinating! Bookmarked!

  3. Aisling says:

    cool good fun for my child

  4. Pingback: Teach Kids Programming |

  5. Pingback: jacquelinehumphries

  6. Pingback: 3: Hello World! | Python Tutorials for Kids 13+

  7. click here says:

    Having read this I thought it was rather enlightening.
    I appreciate you spending some time and energy to put this content
    together. I once again find myself personally spending a significant amount of time both reading and commenting.
    But so what, it was still worth it!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.