4. Creating the Frequencies Hash


#1

puts "Text Please";
text gets.chomp;
words = text.split(" ");
frequencies = Hash.new(0)

Oops, try again. It looks like frequencies isn't a hash.

What am I doing wrong?


#2

Many problems here, correct code:

puts "Text Please"
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new()

#3

needs to be.
puts "Text Please"
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new(0)

Thanks for the correct code though was using semi-colons " ; ".


#4

Why does there need to be an = sign in the line for "text=gets.chomp" when it had worked without it before?