4. Creating the Frequencies Hash


puts "Text please: "
text = gets.chomp

words = text.split(" ")
frequencies = Hash.new(0)
words.each { |word| frequencies[word] += 1 }
frequencies = frequencies.sort_by {|a, b| b }
frequencies.each { |word, frequency| puts word + " " + frequency.to_s }

I still get the error of "Oops, try again. It looks like frequencies isn't a hash."

I have also tried 4 browsers and they all come up as an error.



You're missing "do" in your last line:


No, do/end is a block, and so is {}. This is not his issue.


In the exercise 4, they're only asking you to create the hash with 0 as a default value, nothing else. Remove all the unnecessary code.