Becoming more selective - confused


#1
need some help.

my code:




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

#2

Here, they mentioned assigning the select value to a variable 'good_movies' in instructions which is missing in your code and hence the error. Just assign the last line as -

good_movies = movie_ratings.select { |name, rating| rating > 3}

This should do it :smile:


#3

bons_films.select {|nom, note| films_notes >3 }


#4

Hm.
"Long" code below same result, but : "Oops, try again. It looks like good_movies doesn't include primer, but it should! "

good_movies = Hash.new

movie_ratings.select do |k, v|
if v > 3
good_movies = {
k => v
}
end
end


#5

Interesting I have good_movies = movie_ratings.select{ |k, v| v > 3 } and im getting the following error: (ruby): syntax error, unexpected tIDENTIFIER, expecting $end
8movie_ratings = {

I am stuck.


#8

you should put this :

bons_films= films_notes.select {|nom, note| note >3 }