How do you "Add that movie/rating pair to the movies hash"


#1



I get the message: Oops, try again.
It looks like you didn't add star wars to the movies hash!

can you check my code?


movies = { "Miracles from Heaven" => 4}
puts "Input a movie"
choice = gets.chomp
case choice
when "add"
  puts "What is the movie title?"
  title = gets.chomp
  puts "What is the rating?"
  rating = gets.chomp
  movies.push(title, rating)
  when "update"
  puts "updated"
  when "display"
  puts "Movies!"
  when "delete"
  puts "Deleted!"
  else
      puts "Error!"
  end


#2

The above is an array method, for appending an array. It will not work on a hash.

movies[title.to_sym] = rating.to_i

Which lesson is this? The above may apply to a later lesson. At bare minimum, early on in the module,

movies[title] = rating

may be sufficient to pass the lesson. Will verify once I know which lesson this is.


#3

It's Prompting: Redux! from A Night at the Movies.