Redacted - 5/6 :


#1

UPDATE: I had one of my colleagues, a Principle Developer at my company look at the exercise’s instructions and my code and verify that not only does the program work according to the instructions, but also that the code is more or less correct. Can someone from CodeAcademy please help?

I’m Having trouble with REdact exercise 5/6
My code appears to be correct and it “works”, but it is still giving me an incomplete red “X” and giving me this error: “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!).”

My code IS doing all those things though

puts "Write something"
text = gets.chomp

puts "Tell me what words to redact"
redact = gets.chomp

word = text.split(" ")
word.each do |word|
  if word == redact
  print "REDACTED "
    else 
    print word + " "
  end 
end

https://www.codecademy.com/courses/learn-ruby/lessons/redacted/exercises/control-flow-know-how?action=lesson_resume


#2
plural.each do |singular|

Eg.

words = text.split(' ')

#3

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