9. What am I missing?


The instructions seem straightforward and simple enough yet I can't pass:

Accessing Hash Values
You can access values in a hash just like an array.

pets = {
"Stevie" => "cat",
"Bowser" => "hamster",
"Kevin Sorbo" => "fish"

puts pets["Stevie"]

will print "cat"

In the example above, we create a hash called pets.
Then we print cat by accessing the key "Stevie" in the `pets hash.
Access the key-value pair you added to pets, just like step 2 in the example above.
Use puts to print that value to the console.

To print a value associated with a key my_key in a hash called my_hash, you'd write

puts my_hash["my_key"]

My code(which seems to work in the console just fine):
pets = Hash.new
pets["Revely"] = ["dog"]
puts pets["Revely"]

error: "Oops, try again. It looks like you didn't print out the value of each of the keys stored in your hash."

Am I missing something obvious or do the instructions not match the error message, or something else?


nevermind. This works:

pets = Hash.new
pets["Revely"] = "dog"
puts pets["Revely"]

(had to remove [] from "dog") ::smacks forehead::