title: Creating Vectors with Python
body: <p>I'm creating a vector class that has one parameter being the length of a vector. The length is automatically 0 if none is entered by user. If a vector is given a length, however, each number will be set to 0. For example: <code>v(5)</code> would be <code>[0,0,0,0,0]</code> and <code>v()</code> would be <code>[]</code>.
  This is the code i have thus far, but it's not quite working. Any advice?</p>
  
  <pre><code>class V:
  
      def __init__(self, length = 0):
          self.vector = [0]*length
      def __str__(self):
          print(self.vector)
      def __len__(self):
          return len(self.vector)
  </code></pre>
  
  <p>Then i plug in <code>a = V() b = V(5)</code> and when i <code>print(a)</code> and <code>print(b)</code> i get an TypeError. Any advice?</p>