Glitch in system?
There seems to be a glitch in the system. For the redacted problem I wrote the following code:
puts “Enter a line of text.” text = gets.chomp puts “Enter a word to redact from the line of text.” redacted_word = gets.chomp words = text.split(“ “) words.each do |word| if word == redacted_word print “REDACTED “ else print word + “ “ end end
It worked perfectly. When given a line of text and a word to redact, it would print out the line of text, but with the word to redact replaced by REDACTED. However, the system keeps giving me an “Oops, try again” message.
Answer 535cb8b97c82ca8e2b0017fb
Answer 5363231780ff33fbd0000dd5
I’m having the same issue. It’s showing the code as working perfectly, but I’m getting the “Oops, try again” message at the bottom.
Answer 536325bb282ae38916000c51
I think I figured out the glitch. If I run the code and enter a string of text, then enter a word to be redacted that ISN’T in the sentence, it magically tells me I’m correct and lets me move on. Definitely a bug I think.
Answer 5365202c80ff334858001c4b
Answer 538224248c1ccc4f2c004f52
For my issue, I just had to add a space after the redaction, like this: “REDACTED “
Here is my code that worked:
puts "Enter a string: "
text = gets.chomp
puts "Enter another string: "
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if (word == redact)
print "REDACTED "
else
print word + " "
end
end
Popular free courses
- Free course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner Friendly4 Lessons - Free course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner Friendly11 Lessons - Free course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner Friendly6 Lessons