Can someone point out what i did wrong here?


#1


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


This is what i put down.
puts "input here"
text = gets.chomp

words = text.split(",")
frequencies = Hash.new(0)

words.each do |x|
frequencies[x]+=1
frequencies = frequencies.sort_by {|word, count| count}
frequencies.reverse!
end

frequencies.each { |name , count| puts name + " " + count.to_s }
`


#2

When we split a string, the array already has comma separators. The split() method needs us to specify what character to split on. Being as we are a handing in a sentence, the separators are spaces.

words = text.split(" ")

You may have discovered and fixed this already...

    end

should follow those two lines, The other two are meant to be outside of the method.