Haven't set the frequencies correctly


#1



https://www.codecademy.com/courses/ruby-beginner-en-693PD/0/6?curriculum_id=5059f8619189a5000201fbcb#


I keep getting this error message, but my code seems to work correctly... Can anyone help?

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


puts "Text Here: "
text = gets.chomp
words = text.split
frequencies = Hash.new(0)
words.each {|y| puts frequencies[y] += 1}
words = words.sort_by {|word, freq| freq }
words.reverse!


#2

Remove puts. We cannot print and assign in the same statement.


#3

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