Redacted 4/6


I’m trying to figure out what im doing wrong in this question.
My code goes like this:

puts "Enter words to redact"
text = gets.chomp

puts "Enter text: "
redact = gets.chomp

words = text.split(’ ')
words.each do |placeholder|
print words

I know that im supposed to print each word that the user types in the text input, but for example if you type “Hello world” in the user input then it comes out as:
"[“Hello”, “world”][“Hello”, “world”]".
I have no idea what im doing wrong.


Rather than printing the whole array once for each word in the array, print each word


Ah it works now Thank you


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