Lesson 4 of Redacted!


#1


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

So I keep getting this error every time I run the program and it's mind boggling me. I've tried it in many different variations from the community here they all give me the same error message.
Oops, try again. It looks like you didn't print each word from the user's text to the console.


puts "Type a sentence. "
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


#2

Hey hi. I copied and paste your code and it didn't showed me any errors, but I noticed that it is replacing all the words of the text instead of replacing just the "redact" word. so if the word == redact you should print "REDACTED ", and else you should print the word + " ", try just changing this two lines of code and i think it may help.

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


#3

Same error. I'm not sure what I should do.


#4

I'm getting the exact same thing. So lost.


#5

I'm getting the same error. It says my users input is NOT printing into the console, but it clearly is.


#8

This was my code and it got through.

puts "text"
text=gets.chomp
puts "redact"
redact=gets.chomp

words=text.split("")

words.each do |word|
print word
end


#9

guys i did it got it right just look at it