Sorting the Hash problem, need some help please


Oops, try again. It looks like you haven't set the frequencies hash correctly. Check the first exercise if you need help!

puts "text from the user"
text= gets.chomp

words= text.split(" ")

words.each { |word| frequencies[word] += 1 }
frequencies= frequencies.sort_by {|x,  y| y }


Make sure you're creating the Hash with the correct syntax.

If you go back to "4. Creating the Frequencies Hash", you should notice a difference between what you did there to create the Hash and what you're doing here.


Thanks , found it :stuck_out_tongue:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.