My array of arrays exercise - correct behaviour is achieved yet the auto grading part says I did something wrong


So far everything has been going great in the course. I wrote the following code and it worked but there is a message coming up saying that it did not work. This is although I am looking at the correct results in the console.

s = [["ham", "swiss"], ["turkey", "cheddar"], ["roast beef", "gruyere"]]
s.each do |sandwich|
    sandwich.each do |ingredient|
        puts "#{ingredient} "
    puts "\n"


Hi try to remove this puts

puts "\n"

I think that puts will print averything on his own line so you don't need of the '\n'


That '\n' actually allows my output to have the contents of each sub array separated from the contents of the next sub- array etc. I changed puts "#{ingredient} " to puts ingredient. That got rid of the error and everything worked perfectly. Thanks so much for the feedback though.


Probably the trailing space.

Usually it's the simplest most obvious interpretation of what the instructions describe, like puts ingredient as you said. The exercise's author has to have anticipated your output and often wasn't being very exhaustive.