In [1]:
from plotting import plot
L = [[2, 2], [3, 2], [1.75, 1], [2, 1], [2.25, 1], [2.5, 1], [2.75,
1], [3, 1], [3.25, 1]]
plot(L,4)
In [2]:
#Quiz 2.4.4
def addn(u, v):
return [x+y for (x,y) in zip(u,v)]
print addn([1,2,3], [3,2,1])
In [7]:
class Vec:
def __init__(self, labels, function):
self.D = labels
self.f = function
def zero_vec(D):
return Vec(D, {d:0 for d in D})
d = {1,2,3}
print zero_vec(d)
In [ ]: