In [2]:
%pylab inline
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)
In [14]: