Python Basics

In these and following examples we'll be using a couple of programming things which are simple enough that, should you not be familiar with them, you might be able to figure out from the contect. While the experienced programmers will tap their feet impatiently for this to finish, and the newbies are struggling to pick their dicts from their strings: a very short overview of the stuff you're missing.

Types

The information that you want to work with in programming comes in different forms and colors: text, numbers, sequences of things. Python offers a nice range of tupperware boxes to stick them in. More things to keep track of, but: useful and these will be your friends.

# examples of tuples
aTuple = (1, 2, 3)
aTuple = ("a", "b", "c")

Tricks with strings

In some places in this manual we're using string formatting operations . These are somewhat cryptic looking but very useful ways of getting different sorts of data into a string. The python documentation describes them.

# examples of string formatting

# insert an integer into a string
print "A cube has %d sides." % 6

# insert a string into a string
a = "Thursday"
print "Today is %s." % a
A cube has 6 sides.
Today is Thursday.

Enough

And that's really all we're going to say about this. Figure out the rest yourself.