Create a histogram - default value (0)


#1

what have I done - the error message is:

Oops, try again. Did you create your hash with a default value of 0?

i thought that I had set the default value to (0)

thanks

puts "text please:"
text = gets.chomp
words = text.split
frequencies = Hash.new("0")


#2

The text.split method requires an empty pair of quotation marks wrapped in parentheses,

words = text.split(" ")


#3

hi

thanks,

still getting same error message

puts "text please:"
text = gets.chomp
words = text.split (" ")
frequencies = Hash.new ("0")


#4

You shouldn't have a space between text.split and (" "),


#5

same error - I can not get this to work


#6

Oh wait lol I've just found your error you shouldn't put quotation marks around the 0 on this line,


#7

and there it was............

thanks


#8

You're welcome also take a look at this topic,


#10

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