11/14 Hashes and Symbols..... Why it does not working?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

good_movies = {
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.select {|name, movie_ratings| movie_ratings > 3}


Error: Oops, try again. It looks like good_movies includes memento, but it shouldn’t.

But it is not includes memento when i run the code

Please help!!

<do not remove the three backticks above>

That’s because good_movies.select {|name, movie_ratings| movie_ratings > 3} - is what you want, but it’s just a copy of good_movies. If you were to call variable good_movies you’d see that it didn’t change - it still containt all of the movies. Use bang! methods to modify the original object. In this example - select!. Read about bang methods here.

1 Like

Thank you, I get it now! :slight_smile:

or assign the temporary hash to a new variable with the code model you have now.

top_rated_movies = good_movies.select { ... }
1 Like

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