title: Python - TypeError: 'int' object is not callable
body: <p>(Using Python 2.7)</p>
  
  <p>Hello, </p>
  
  <p>I've two version of a class PairOfDice.</p>
  
  <p>1.) This one is not working and throws an error. </p>
  
  <blockquote>
    <p>TypeError: 'int' object is not callable</p>
  </blockquote>
  
  <pre><code>import random
  
  class PairOfDice:
      """ Represent the Pair of Dices and have method which tells the total of those roles.
      """
      def roll(self):
          self.total = random.randint(1, 6) + random.randint(1, 6)
  
      def total(self):
          return self.total
  
      def name(self, name):
          self.name = name
  
      def getName(self):
          return self.name
  
  player1 = PairOfDice()
  player1.roll()
  print player1.total()
  </code></pre>
  
  <p>2) This one is working.</p>
  
  <pre><code>import random
  
  class PairOfDice:
      """ Represent the Pair of Dices and have method which tells the  total of those roles.
      """
      def roll(self):
          self.roll1 = random.randint(1, 6)
          self.roll2 = random.randint(1, 6)
  
      def total(self):
          return self.roll1 + self.roll2
  
      def name(self, name):
          self.name = name
  
      def getName(self):
          return self.name
  
  player1 = PairOfDice()
  player1.roll()
  print player1.total()
  </code></pre>
  
  <p>Can please someone explain what's wrong with the first one?</p>
  
  <p>Thanks</p>