title: Histograms: "TypeError, list indices must be integers, not str"
body: <p>I am trying to make a function that will take a character and a histogram and add an instance of that character to the histogram. My code so far is like this: </p>
  
  <pre><code>def add_to_hist(character, histogram):
      """Takes a character and a histogram and adds an occurrence
         of that character to the histogram.
  
      string, list -&gt; list"""
      for c in character:
          if c not in histogram:
              histogram[c] = 1
          else:
              histogram[c] = histogram[c]+1
      return histogram
  </code></pre>
  
  <p>Every time I try to run the code it returns with <code>TypeError: list indices must be integers, not str</code>. Can anyone help me figure this out? My code actually might be entirely wrong, I'm very new at this. Thanks in advance!</p>