Lesson 5 of Redacted!
The code replaces the word that is set to be redacted as as the term "REDACTED". However the error message reads that "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 think my code does just this but I'm very confused. I looked at similar issues on the forum but am still having trouble solving it.
puts "Please enter a phrase." text = gets.chomp puts "Redact which word?" puts redact = gets.chomp words = text.split (" ") words.each do |word| if word == redact print "REDACTED" else print word + "" end end