# 14 Hashes and Symbols


The code appears to work however I'm getting the message that primer is not listed and I cannot pass.

Here is the output:


movie_ratings = {
  memento: 3,
  primer: 3.5,
  the_matrix: 5,
  truman_show: 4,
  red_dawn: 1.5,
  skyfall: 4,
  alex_cross: 2,
  uhf: 1,
  lion_king: 3.5
# Add your code below!

good_movies = movie_ratings.select do |m,r|
    if r > 3
        puts m


A select loop is quite intricate as such you don't need an if statement to print out hash values for example look at this code,

people = {
  Dave: 10,
  Scriptplayer: 20,
  person: 30,


people = movie_ratings.select { |x, y| y > 10 }

The code above will print out only scriptplayer and person because I have a condition that checks if y the value of the key is greater than 10. :slight_smile: You can use this same logic to structure your good_movies loop. :slight_smile:


select has its own built in conditional; all we supply is the expression.

good_movies = movie_ratings.select do |m, r|
    r > 3

If may be that the SCT is checking the code but does not have an appropriate error message.


thanks all that solved my problem


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