title: Why do I get this Error in ruby: block in find_word_lengths': undefined method `[]=' for 3:Integer (NoMethodError)
body: <p>the following code return this error:</p>
  <blockquote>
  <p>block in find_word_lengths': undefined method `[]=' for 3:Integer (NoMethodError)</p>
  </blockquote>
  <pre><code>animals = ['cat', 'horse', 'rabbit', 'deer']
  
  def find_word_lengths(word_list)
    word_list.reduce(Hash.new()) do |result, animal|
      result[animal] = animal.length
    end 
  end
  
  puts find_word_lengths(animals)
  </code></pre>