4/6 I need some help here


#1

I'm having some trouble with this step.

My code so far is:

puts "Any type of text just give me some words please"
text = gets.chomp

words = text.split (" ")

puts "Words to redact"
redact = gets.chomp

words.each do |words|
print words+""
end

What is not working here?

Could anyone explain the steps to me? Thanks!


#2

puts "Text to search through: "

text = gets.chomp

text="This is not a long text this is"
puts "Word to redact: "

redact = gets.chomp

redact = "is"

you will want to split the text

using a =space= char as separator

words = text.split (" ")

why redfine ??? words = ['a', 'b', 'c', 'd']

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


#3

@milouschelling

The problem is with the words in between the || and after print. Try replacing them by word


#4

unfortunately this still doesn't work :cry:


#5

Got it!

text = gets.chomp
puts "text"

text = "Just a few words to finish this assignment"

redact = gets.chomp
puts "redact"

redact = "and some more to redact"

words = text.split(" ")

words.each do |words|
print words+""
end

Thanks for the help guys!