Prompting redux!


#1

please help can't figure this out :

movies = {
"gladiator" => 5,
"tomb raider" => 4.5,
"home" => 3}

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

case choice
when "add"
puts "Enter movie title!"
title = gets.chomp
puts "what is the rating? (Enter 0-5)"
rating = gets.chomp
movies = {"title" => "rating"}
puts "#{title} has been added with a rating of #{rating}"

when "update"
puts "updated!"
when "display"
puts "movies"
when "delete"
puts "deleted!"
else
puts "Error!"
end

please help the editor is giving me an error

Oops, try again. It looks like you didn't add to the movies hash!

Replace this line with your code.


#2

HI you should add it to the hash movies like that

movies[title] = rating

instead of

movies = {"title" => "rating"}

#3

tried it still the same error


#4

can you post your new code?


#5

movies = {
"gladiator" => 5,
"tomb raider" => 4.5,
"home" => 3}

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

case choice
when "add"
puts "Enter movie title!"
title = gets.chomp
puts "what is the rating? (Enter 0-5)"
rating = gets.chomp
movies[title] = rating
puts "#{title} has been added with a rating of #{rating}"

when "update"
puts "updated!"
when "display"
puts "movies"
when "delete"
puts "deleted!"
else
puts "Error!"
end


#6

when you Save & Submit the code you should type add in the console then you should type the name of the movies you want to add


#7

oh Thank you sooo much finally I can go forward now