Can anybody help me with this?


#1



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


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


movies = {
    Nonstop: 5,
    Thethreestooges: 5,
    Dumbanddumbertoo: 5
}
puts "Which movie do you like?"
answer = choice
case choice
when "add"
  puts "Enter a title"
  title = gets.chomp
  puts "Enter a rating"
  rating = gets.chomp
  movies[title] = rating
  puts "the pair was added"
when "update"
  puts "Updated!"
when "display"
  puts "Movies!"
when "delete"
  puts "Deleted!"
else
  puts "Error!"
end


#2

Hello @dataace57202,

Your problem lies in the fact that your have never managed to get the choice variable from the user. Replace

answer = choice

with

choice = gets.chomp

Hope this fixes your problem...


#3

I'm having the same problem too (getting the error message "Oops, try again. It looks like you didn't add Ishtar to the movies hash!").

I've tried with a few code options (with different movies) given as correct on the forum (including the one you corrected above) and just get EXACTLY the same error message after adding my movie choice in the prompt.

Any help would be great, thank you!


#4

Hello @agr_donald,

Can you please post your entire code, wrapped in triple backticks (THESE THINGS => `). Then I'll be able to help you further...


#5

thank you.

Here is the code I am trying this time (I'm really sorry but I still don't understand what you mean by TRIPLE BACKLINKS so I will just paste and hope this works).

Just to confirm, I am getting the following message when I type in whichever movie into the console "
Oops, try again. It looks like you didn't add Ishtar to the movies hash!"

CODE:

movies = {
Nonstop: 5,
Thethreestooges: 5,
Dumbanddumbertoo: 5
}
puts "Which movie do you like?"
choice = gets.chomp
case choice
when "add"
puts "Enter a title"
title = gets.chomp
puts "Enter a rating"
rating = gets.chomp
movies[title] = rating
puts "the pair was added"
when "update"
puts "Updated!"
when "display"
puts "Movies!"
when "delete"
puts "Deleted!"
else
puts "Error!"
end


#6

Your code should work perfectly... I as a matter of fact posted it into my own exercise and found it to be perfect. Your error must be coming from a different source, like a buggy web browser etc... Try refreshing the page, because your code is correct...


#7

thank you again.

I have cleared the code, refreshed the page, logged in and out and am trying on both chrome and firefox. I am still getting an error message (very slightly different) after I put my movie choice into the console
"Oops, try again. It looks like you didn't add to the movies hash!"

Can I ask what browser you use please? I will try that. Thank you for your patience


#8

Hello @agr_donald,

I use both Chrome and Safari on a Mac for my Codecademy...


#9

ok, thank you! I don't have a mac right now so hopefully I can find another work around for this.