title: How to create Fibonacci series in python using objects
body: <p>I'm learning objects in python.  I'm trying to write python code for the fibonacci series. </p>
  
  <pre><code>class palindrome:
      p=0
      q=1
      r=0
      def __init__(self,number):
          self.number=number
  
      def calc(self):
          p=0
          q=1
          r=0
          if (self.number == 1):
              print "0 1"
          for i in range(3,1):
              r = p + q
              p = q
              q = r
              print " %d " %r
  
  pal = palindrome("1")
  print pal.number()
  </code></pre>
  
  <p>When I run this program with different values it shows an error.  If I pass an object 1 then it does not print 001 and also if I pass in some how do I print something for the 1st time and never print it again. for example 0 1 in fibonacci series. </p>
  
  <p>So when I try to put this statement in for loop 'for I (3, self.number)' it throws an error saying that you cannot define a string in int. So how do I pass in the value of object in the for loop. Also how do I compare self.number == 1 and print the message. </p>