title: Keeps only one entry instead of appending to the dictionary
body: <p>I want to take person's name and their phone number from the end user and append to a dictionary. I started with an empty dictionary.</p>
  
  <p>After first user inputs the data, the program will say a new entry is added and display what is inside the updated dictionary. It works fine so far.</p>
  
  <p>When the second user inputs the data it should do the same thing:</p>
  
  <ol>
  <li>Say a new entry is added</li>
  <li>Display everything in the dictionary meaning, first user's as well as second user's input. But it is not working as expected. It only shows the second user's input but not first user's input.</li>
  </ol>
  
  <p>Can someone tell why this is failing to append to the existing data? I see only one entry each time (whoever is the latest).</p>
  
  <p>Here is the program:</p>
  
  <pre><code>class phonebook:
      allphones = {} # Empty dictionary
  
      def __init__ (self, name, phone):
          self.pername = name
          self.perphone = phone
  
      def adddata(self):
          phonebook.allphones[self.pername] = self.perphone # append to the dictionary
          print ('A new phone book entry added - {0}:{1}'.format(self.pername, self.perphone)) # confirm the input
          print (phonebook.allphones) # display what is inside the phonebook  
  name = input('Type person\'s name --&gt; ')
  phone = input('Type phone\'s name --&gt; ')
  adding = phonebook(name, phone)
  adding.adddata()
  </code></pre>
  
  <p>Here is the updated program &lt;-----------</p>
  
  <pre><code>class phonebook:
  
      def __init__ (self):
          self.allphones = {}
  
      def adddata(self, name, phone):
          self.allphones[name] = phone # append to the dictionary
          print ('A new phone book entry added - {0}:{1}'.format(name, phone)) # confirm the input
          print (self.allphones) # dump the complete phonebook data
  
  name = input('Type person\'s name --&gt; ')
  phone = input('Type person\'s phone number --&gt; ')
  
  adding = phonebook()
  adding.adddata(name, phone)
  </code></pre>
  
  <p>Here is the output I get (I want <code>{'abc': '123', 'ghj': '505050'}</code> as the answer) -</p>
  
  <pre><code>&gt;&gt;&gt; ================================ RESTART ================================
  &gt;&gt;&gt; 
  Type person's name --&gt; abc
  Type person's phone number --&gt; 123
  A new phone book entry added - abc:123
  {'abc': '123'}
  &gt;&gt;&gt; ================================ RESTART ================================
  &gt;&gt;&gt; 
  Type person's name --&gt; ghj
  Type person's phone number --&gt; 505050
  A new phone book entry added - ghj:505050
  {'ghj': '505050'} 
  &gt;&gt;&gt; 
  </code></pre>