Lesson 5 create a histogram


#1

puts "Text please: "
text = gets.chomp

words = text.split"do/end"
frequencies = Hash.new(0)
words.each { |word| frequencies[word] += 1 }
frequencies = frequencies.sort_by {|k, v | v }
frequencies.reverse!
frequencies.each { |word, frequency| puts word + " " + frequency.to_s }

The remark in the Editor says that "you have not added key value pairs in the Hash.
Pl tell me what key value pairs have to be added.


#2

Are there any error messages in the console?


#3

I think that you only need to put: words = text.split
I don't know why you use the "do/end"