In [2]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [4]:
d = arange(10)
s = 'abcdefghij'

print d[1:3]
print d[:3], d[0:3]
print d[3:10], d[3:]
print d[0:10:2], d[::2]
"""I tried to fix this but I don't know how!"""
print d[-1::-1], d[::-1], d[:10:-1]

"""Index slicing on the d array. Format:  'start:end:step' """
print [str(num)+character for num,character in zip(d[-3:],s)] 
print [str(num)+character for num,character in zip(d,s)]

'''[] make the command a list'''
print [str(num)+character for num,character in zip(d[:3],s)] 

''' str(num)+character creates each element in the list as a string type. The for loop is a list comprehension because of the brackets
around the statement. The for statement is also like a map, one line function.'''

thelist = []
for tmp in zip(d,s): #tmp is a tuple
    print tmp
    thelist.append(str(tmp[0])+tmp[1])
    
print thelist

j,k = (4,5)


[1 2]
[0 1 2] [0 1 2]
[3 4 5 6 7 8 9] [3 4 5 6 7 8 9]
[0 2 4 6 8] [0 2 4 6 8]
[9 8 7 6 5 4 3 2 1 0] [9 8 7 6 5 4 3 2 1 0] []
['7a', '8b', '9c']
['0a', '1b', '2c', '3d', '4e', '5f', '6g', '7h', '8i', '9j']
['0a', '1b', '2c']
(0, 'a')
(1, 'b')
(2, 'c')
(3, 'd')
(4, 'e')
(5, 'f')
(6, 'g')
(7, 'h')
(8, 'i')
(9, 'j')
['0a', '1b', '2c', '3d', '4e', '5f', '6g', '7h', '8i', '9j']

In [14]: