4/6. Redacted


#1

Hi there. Could someone please help me solve this problem? I do not understand what is the problem with my code. I have tried refreshing the browser and looking at other discussions similar to this. they have the same code but mine does not work. Here is my code:

puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
  if word != redact
    print word + " "
  else
    print "REDACTED "
  end
end

This is what it says:

Oops, try again. It looks like you didn't print each word from the user's text to the console.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.