Make sure to print each word error 5/6


#1



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

Here is the error message I get:" Oops, try again. Make sure to print each word from the user's text to the console unless that word is the word to be redacted; if it is, print REDACTED (all caps!)."

I'm sure I'm missing something silly, I just cannot figure out what it is. HELP?


puts "Your text"
text = gets.chomp
puts  "Words to redact"
redact = gets.chomp

words = text.split(" ")

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


#2

Can't reproduce what you describe with your code


#3

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