Exercise 5. Iterating over the array


#1

Can someone help me? I'm really confused on this exercise, It's probably a silly mistake, but I'm just not understanding anything even with the hint. I went back and checked out the first lesson in the Histogram chunk and I can't figure out what is wrong.

puts "Text Please: "
text = gets.chomp
words = text.split
frequencies = Hash.new(0)
words.each
frequencies[word]+= 1

Exercise 5. Iterating over the array
#2

What do you want it to do differently, what's the problem? You're not giving us anything to reply to.


#3

I can't seem to get the error to go away so I can pass the lesson. I'm stuck. Whatever the instructions are along with the hint, aren't helping me at all to figure out what the lesson doesn't like about what I have done. I just don't understand what I am doing wrong.


#4

See the error message ruby is giving you? It says you're using a variable that you haven't defined


#5

Really now? I would never have guessed. Perhaps I'm asking for help because I don't understand what I'm doing wrong.


#6

You did not acknowledge that you had seen that ruby was telling you what the problem is.
You asked what you're doing wrong. Ruby says what you're doing wrong.
Don't be so surprised when you get an answer to what you asked. If you want other information then ask for that other information, that burden is on you.

I won't go from "I don't know what it doesn't like" all the way to "here's the solution". Most of that is for you to do. Ask about the parts you can't do, ask when you're stuck in getting there.


#7

I'll get the help I need from someone who isn't going to be a jerk. Something you lack.


#8

I answered your question. If being a jerk means not asking more questions for you and then also answering what I had to ask myself. Then yes, I am.

You don't get to make it my responsibility to get you the answers you want. It's up to you to steer the conversation in that direction by explaining how far you've come and what has you stuck, by asking direct questions.

Is it really too big of an ask that you explain yourself what it is you want to know?


#9

I wanted a bit of help because I don't know what I am doing wrong. Your help is just to tell me what I already know which makes it entirely useless. I don't need your brand of "help" I need an explanation of what I am doing wrong. Is it too much for you to explain what I am doing wrong and actually give me an idea of what to do? It seems to be too much for you.


#10

It's up to you to lead me to explain what you want. Refining your question isn't such a horrific thing to have to do. Take responsibility for your own questions instead of blaming me for not compensating.


#11

I will ask someone else because you are being useless. I'm done with you. I'll see you in the hottest pit Satan has.


#12

Well that's kind of hateful. The world needs less of that. A whole lot of times it's possible to just part ways without wishing each other anguish.


#13

Stuck? Get a hint!

puts "text:"
text=gets.chomp
words = text.split (" ")

frequencies = Hash.new(0)

words.each { |x|
x = frequencies[x] += 1
}


#14

@cactusking0, you 1) lost DO and END (for shorter {} ) in .each method of your code and 2) you lost an ITEM |word| also :

puts "Type your text, please: "
text=gets.chomp
words = text.split()
frequencies = Hash.new(0)
words.each {|word| frequencies[word] += 1}

#15

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