This forum is now read-only. Please use our new forums! Go to forums
Redact code looks correct but still get error
Here is my code. The expected results happen but I am still getting an error below and I can’t continue.
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!).
print "What is your input?"
text = gets.chomp
print "Word you want to redact"
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if word != redact
print "#{word} "
else
print "REDACTED "
end
end
Alex J edited this post to fix code formatting
Answer 527ba1cef10c609882003054
The (SCT) submission correctness test of this exercise is currently broken. It incorrectly refuses your correct solution.
Answer 52b60b7f80ff3364df0030fb
The code that worked for me :
puts “Text:” text = gets.chomp
puts “Redact” redact = gets.chomp
words = text.split (“ “)
words.each do |words| print “#{words}” end
2 comments
Worked for me too.
I tried this and it did not work for me, I’m getting really stumped here
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 friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
6 comments
Is this still broken? I am currently not able to get past this either with the same code as above. Grrr
I had to just refresh the browser. I have found that to be the solution most of the time that I think my code is correct but it fails the validation.
@madhatter84gn can you please post the code you passed with? I’m pretty sure the tester isn’t working correctly.
Yes getting same issue, please update code otherwise i can’t get points :)
post the code!! This exercise is retarded!
Alex the code above is what I was using. I simply had to refresh the browser and paste it back in order to get it to work. If it is not working for others, then I may need to go back to the sample to see if I can recreate the issue. It finally worked for me because I was able to continue and complete the ruby path.