I'm getting "Way to go" but preview doesn't show the data I filtered out


#1



https://www.codecademy.com/courses/ruby-beginner-en-Qn7Qw/2/4?curriculum_id=5059f8619189a5000201fbcb#


I'm getting "Way to go" but preview doesn't show the data I filtered out. I should be getting all movies that has rating greater than 3 but I'm getting green and just curly braces in preview. Is it ok ?


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
}


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


#2

@markiscoding,
You might try to use

movie_ratings= good_movies.select {|name, rating| rating > 3}
for anArray in movie_ratings do
    puts "#{anArray[0]} == #{anArray[1]}"
    end

#3

The result was even worse. It's kinda odd. I suppose the code is correct since Codecademy approved it but I should get to see it working in preview.

Thanks anyway !


#4

@markiscoding,
You did see that you where selecting from the wrong source ???
I used (the old-style) object definition

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
}


movie_ratings= good_movies.select {|name, rating| rating > 3}
for anArray in movie_ratings do
    puts "#{anArray[0]} == #{anArray[1]}"
    end

and got the result

the_matrix == 5
lion_king == 3.5
truman_show == 4
skyfall == 4
primer == 3.5