Prompting: Redux! (4/10) Oops, try again


#1

I tried to pass but I received the following error:

"It looks like you didn't add to the movies hash!"

Here is my code:

    movies = {
    "The Godfather" => 7.3,
    "Taxi Driver" => 6.9,
    "Gone with the Wind" => 7.2,
    "Saturday Night Fever" => 7.1,
    "Apocalypse Now" => 6.8
}

puts "what is your movie?"
choice = gets.chomp

case choice
when "add"
    puts "What is your movie?"
    title = gets.chomp
    puts "What is the movie's rating?"
    rating = gets.chomp
    movies[title] = rating
    rating = {}
    numbers["one"] = 1
    puts 7 + numbers["one"]
    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

Why my code doesn't work? What should I do?


#2
rating = {}

This line will erase the content of your variable, if you want to use it with puts afterwards, you shouldn’t erase it.

numbers["one"] = 1
puts 7 + numbers["one"]

These lines are not relevant to the exercise, you should remove them. If you want to experiment, you should try the lab instead: labs repl.it because the lessons have specific checks regarding what’s expected from the instructions, adding your non-relevant code can sometimes mess up the checks.