Redacted 4/6


#1

I'm putting this here just to save others the frustration i just had with this.

puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
print word #or print word + " "
end

or similar may result in this output

Oops, try again. It looks like you didn't print each word from the user's text to the console.

The only fix i found for this is to use

print word + "" # with no space

This seems to be a bug in the tutorial.

Good luck


#3

Thanks!!!
but I still do not understand the subject :joy:


#4

Thank you so much! I was struggling with this, but with your help it worked correctly!


#5

Is this really a bug in the tutorial because there is a space in the example?
could someone please explain this, it is really frustrating.
I feel like the tutorials do not go into near as much detail as they could or should
is stuff being left out?


#6

Me neither, I feel like I am just copying the answers from here most of the time. I wish there was a way to discuss these topics without people just blatantly posting the answers to copy. We're not in highschool trying to get a's and b's to get our allowance, I am pretty sure most of us are here to learn.


#7

From what i could tell, it's a bug in the tutorial because there should be a space between the words. adding the space after it in print word + " " gave the right output but error when submitted.

I feel like the tutorials do not go into near as much detail as they could or should
is stuff being left out?

To answer your question here, I think a lot of the detail was left out here by design. The tutorials here are aimed at getting a complete novice to a place where they can hack together a quick solution. It's not meant to replace a good book or formal CS training.

Me neither, I feel like I am just copying the answers from here most of the time.

To be honest that's how most programmers start. Along with adequate googling and persistence, you'll find yourself capable of solving any problem. Just don't give up and see it through


#8

Thank you for that reply, it is easy to get frustrated but people like you make it easier to keep on. I have noticed a lot of support and understanding for beginners in the programming community and I love it.
Thanks for helping out.


#9

Hi....I have the same problem I tried to follow your advice but still I have Oops,try again.it look like you.....
do you have any more suggestion??thanks


#10

Can you share your code? I'll take a look and see if I can help


#11

puts "stefano bo:"
text=gets.chomp
puts"dirisio bo:"
redact=gets.chomp
words=text.split (" ")
words.each do |word|
print word
end


#12
puts "stefano bo:"
text=gets.chomp
puts"dirisio bo:"
redact=gets.chomp
words=text.split (" ")
words.each do |word|
print word + ""    #Notice the empty string, with no space inside
end

I've made a change in your code. See above. Your solution is correct and should work. But there seems to be a bug in the System that labels it as incorrect.

Good luck


#13

...I tried also this before...and also now again but nothing...thanks anyway)))


#14

I tried everything, like you, until I realized you have to supply the words as in the example which, you're right, the tutorial does not fully explain...here's my code...

puts "Text to search through:"
text=gets.chomp
puts "Word to redact:"
redact=gets.chomp
words=text.split(" ")
words = ['hi', 'hi', 'hi', 'hi']
words.each do |word|
print word
end


#15

Thank you so much! I thought I was going crazy.


#16

Thank you very much! I was getting tired of getting errors.


#17

It's no so much a bug, as their answer-key scanning your result to see if you've got it. You just skipped a step. 5/6 tell you, something like "good going, but now we have to add spaces between the letters" and it's only in 5/6 that you should add > word + " "
not in 4/6


#18

The problem here in 4/6 is that you're skipping ahead. I did the same thing. You're not supposed to add a space yet.

    print "Choose a sentence"
    text = gets.chomp
    print "Choose a word to redact"
    redact = gets.chomp

    words = text.split(" ")

    words.each do |word|
    print word
    end

You'll add the space and finish the code in the next thing part... So right now it's not actually the way it needs to be, but it won't pass the test if you finish it off at this point with the space aka print word + " "
Hope that helps someone


#19

Hi,

I'm going crazy with this exercice :triumph: !!!
It always written "Oops, try again. It looks like you didn't print each word from the user's text to the console."
I try this:

mots.each do |mot|
print mot #or print word + " " #or print word + ""
end

Please, is there someone who can help me?


#20

If you read the beginning of the thread, you will see my post with my work around.

this should give you the results you need

print word + "" # do NOT put a space in the quotes

#21

cssrunner68784,
Thanks for your answer, I've seen your post but even if I write this code, it does not work ! :weary: