title: Why do I get this error while trying to modify a dictionary: "TypeError: unhashable type: 'slice'
body: <p>I'm trying to build a function which gets as an input a string and a number k, and returns a dictionary whose keys are the string of length k from the original string and the value for each key is a sequence of the indexes at which the string appeared.</p>
  
  <p>Running example :</p>
  
  <pre><code>&lt;&lt;&lt; hash_sequence("byebyeboy",3 ( 
  
  { 'yeb': [1, 4], 'boy': [6], 'bye': [0, 3], 'ebo': [5], 'eby': 
  [2] } 
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>def hash_sequence(string, k):
      dictionary={}
      for i in range(len(string)):
          dictionary[i:i+3]=[i]
          if dictionary[i:i+3] in dictionary:
              dictionary[i:i+3]+=[1]
      return dictionary 
  </code></pre>