# This is a list # A list can contain elements of different types. a = [1, 'eplekake', [7, 6, 5] ] b = ['fossefall', 3.1415] print "A list of things:" print a print b # Adding lists: ab = a + b print "Adding lists:" print ab # Multiplying lists print "Mutiplying lists:" c = 3 * a print c # Here is a list of floats x = [0.0, 1.0, 2.0, -1.0] print x print 2*x import numpy as np # we can convert a list of floats to # a numpy array print "Array from list:" y = np.array(x) print x print y # Indexing works the same for lists and arrays: print x[0] print y[0] # Arrays can have more dimensions m = np.zeros( (3, 4) ) print m