>>> l = [2,5,7,8,9, "hello"]
>>> for element in l:
... print l
2
5
7
8
9
hello
>>> l[2] + l[1] # Indeces count from 0
12
>>> l[2:] # list slicing
[7,8,9, "hello"]
>>> composers = ['Bach', 'Beethoven', 'Stravinsky', 'Cage']
>>> import random
>>> print "My favorite composer is " + composers[random.randint(0,3)]
My favorite composer is Bach
>>> d = {"name": "Andres", "surname": "Cabrera", "id": 12345}
>>> print d["name"], d["surname"], "has id:", d["id"]
Andres Cabrera has id: 12345
>>> for key in d:
... print("%s:%s"%(key, d[key]))
surname:Cabrera
name:Andres
id:12345
>>> s = "Hello World"
>>> words = s.split()
>>> print words
['Hello', 'World']
>>> ",".join(words)
'Hello,World'
>>> s.index('W')
>>> s[s.index('W'):]
'World'
>>> f = file("test.txt", 'w')
>>> f.write("Hello")
>>> f.write(" World")
>>> f.close() # Finish writing any pending data
>>> f = file("test.txt")
>>> f = file("test.txt", 'r')
>>> f.read() # readlines() will return a list with the lines
'Hello World'
>>> a = [2,3,4,5,6,7]
>>> b = a[1]
>>> print b
3
>>> b = 10
>>> print a # passed by value i.e. "copied"
[2,3,4,5,6,7]
>>> b = a
>>> b[1] = 10
>>> print a # passed by reference
[2,10,4,5,6,7]
>>> b is a
True