Lesson 4 to 9 stuck up (A night at the movies)


#1

If someone could provide right code for any of the lesson 4 to 9 as this will give me a base to complete other lessons.
Rajesh
coder 68873


#2

@csscoder68873
Providing the code is cheating (View community guidelines). If you want us to help you, please print the code and tell us what error message you get (also please give us a link to the exercise you're doing).


#3

I am also getting a similar error message: 'Oops, try again. It looks like you didn't add h to the movies hash!`
Here is a link to the exercise Lesson 4 A Night at the Movies, 4, Prompting Redux!

Here is my code :

`movies = {
'comedy' => 'Leave it to Beaver',
'drama' => 'Jericho',
'sitcom' => 'Modern Family',
'comic horror' => 'Open Water',
'movie' => 'rating'
}

title = puts "What is the movies title?"

title = gets.chomp

rating = puts "What is the rating of the movie?"

rating = gets.chomp

puts "The pair was added"

puts "Do you like coding in Ruby?"

choice = gets.chomp

case movies
when "add"
puts "What is the movie title?"

title = movies.gets.chomp

when "upadate"
puts "Updated!"

when "display"
puts "Movies!"

when "delete"
puts "Deleted!"

when "rating"
puts "Rating was Added!"

else

puts "Error!"

end`

Here is the prompt that shows up with Standard Out on the right side of the page :

What is the movies title?
h
What is the rating of the movie?
dsfsdfsdf
The pair was added
Do you like coding in Ruby?
sdfsdf
Error!
nil

The literal error message:
Oops, try again. It looks like you didn't add h to the movies hash!

I'm not entirely sure just yet, as to what it is that I'm missing. I would love your help. Thanks!


#4

Just tried this

movies = {
'comedy' => 'Leave it to Beaver',
'drama' => 'Jericho',
'sitcom' =>'Modern Family',
'comic horror' => 'Open Water',
'movie' => 'rating'
}

puts "Do you like coding in Ruby?"
choice = gets.chomp

case choice
when "add"
puts "What is the movies title?"
title = gets.chomp
puts "What is your rating?"
rating = gets.chomp

movies[title] = rating
puts "#{title}has been added with a rating of #{rating}."

when "upadate"
puts "Updated!"

when "display"
puts "Movies!"

when "delete"
puts "Deleted!"
else
puts "Error!"
end

In addition to the code I had posted first. And, I keep getting the same error message.


#5

@csscoder68873

Prompting Redux error 4/10
was solved by adding :

choice = "add" , from http://stackoverflow.com/questions/32211515/codecademy-a-night-at-movies-4-10-prompting-redux/33024914

and

title = gets.chomp.downcase