title: update value in python dictionary by adding a number
body: <p>I want to make a program that adds a name in the dictionary if it doesn't exist already and count the times it is given as input. My code works, however, it doesn't add 1 when it iterates.</p>
  
  <pre><code>namelist = {}
  
  def namen():
      while True:
          word = input('Vul een naam in: ')
          if word == '':
              break
          else:
              for name in namelist:
                  if word == name:
                      namelist[word] += 1
                  # else wasn't properly indented earlier
                  else:
                      namelist[word] = 1
  
  
  print(namen())
  
  print(namelist)
  </code></pre>