4/10 A Night Stuck at The Movies ..... Pleas Help


#1

the code says Oops, try again. It looks like you didn't add The Hateful Eight to the movies hash!

movies = {
    The_Revenant: 8.9,    
}
puts "What would you like to do?"
puts "-- Type 'add' to add a movie."
puts "-- Type 'update' to update a movie."
puts "-- Type 'display' to display all movies."
puts "-- Type 'delete' to delete a movie."

choice = gets.chomp

case choice
    when "add"
        puts "Give the name of your favorite movie?"
        title = gets.chomp
        puts "Give the rating of the movie?.. On a scale of  1 to 10"
        rating = gets.chomp
        movies["title"]= rating
        puts "The movie #{title} has a rating of #{rating}."
    when "update"
        puts "Updated!"
    when "display"
        puts "Movies!"
    when "delete"
        puts "Deleted!"
    else
        puts "Error!"
end

#2

Nevermind I found the error myself it was

movie["title"]= rating

who should be

movie[title]= "rating"


#3

Also, another issue I had with this lesson was that I had all of my code correct, but I was just entering a random title at the first prompt, instead of following my own directions and using the add keyword to move the prompt along. Therefore, the movie and rating were not being added into the hash because I never reached that prompt. It took a few tries to figure that one out but it was super obvious once I did. Thanks for the help clarifying the code on this one though. Cheers!