title: 'int' object has no attribute when calling recursive function in python
body: <p>Not sure what is wrong with the Python code below. Will appreciate any help. I have looked into <a href="https://stackoverflow.com/questions/2630236/int-object-has-no-attribute-startswith">here</a> and <a href="https://stackoverflow.com/questions/22066426/python-error-int-object-has-no-attribute">here</a>, but could not solve my issue.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>class myClass:
      def factorial(n,self):
          if n == 1:
              return 1
          else:
              return n * self.factorial(n-1)
  
  obj = myClass()
  obj.factorial(3)            
  </code></pre>
  
  <p><strong>Error</strong>    </p>
  
  <pre><code>Traceback (most recent call last):
        File "a.py", line 9, in &lt;module&gt;
          obj.factorial(3)
        File "a.py", line 6, in factorial
          return n * self.factorial(n-1)
      AttributeError: 'int' object has no attribute 'factorial'
  </code></pre>