# FAQ: Data Structures - Accessing Hash Values

This community-built FAQ covers the “Accessing Hash Values” exercise from the lesson “Data Structures”.

Paths and Courses
This exercise can be found in the following Codecademy content:

## FAQs on the exercise Accessing Hash Values

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

Agree with a comment or answer? Like () to up-vote the contribution!

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hey guys

am I doing this correctly? i get the correct answer on the console, however, dont get marks to carry on.

my_pets = {
“Jonny” => “dog”,
“Pete” => “cat”,
“James Bond” => “Lynx”
}

puts my_pets[“James Bond”]

not getting a syntax error neither

pets = Hash.new

pets[“Luna”] = “cat”

puts pets[“Luna”]

This example is a little bit broken. Tests won’t pass if the value is not a string. Keep an eye out for that!

After modifying the example code to change the values into numbers, it seems like the value prints to the console as expected.

``````pets = {
"Stevie" => 1,
"Bowser" => 2,
"Kevin Sorbo" => 3
}

puts pets["Stevie"]
# 1 is printed to the console
``````

Be sure to use the key in `puts` and not the value to get the expected result.