Sort 16 Discussions, By:
Please Login in order to post a comment
The fact that range? is a method that you have defined here (in a very hidden way, no less) is extermely confusing. Especially since Ruby has ranges in the std lib. I have 10 years of ruby experience and this question tripped me up. I was off searching docs for the ruby range? method assuming that "already defined" meant "a part of ruby". You need to find a much better way to present the topic of a method taking multiple arguments than this.
feel free to skip the initial set of challenges if you are already an experienced programmer in ruby. The first set of challenges are designed keeping beginners in mind. And the method was defined in assumption that they don't have the knowledge of ruby libraries when trying this question.
@dheeraj, that's not the point though. I think this would be confusing to a newbie as well (and just look at all the confused people here in this discussion thread assuming that the range? method should be available to them on their local machines, for instance. Assuming like I did that perhaps it was some obscure part of std lib that they didn't know). Anyway, I was going through all of the examples to vet this tool as a part of our on-boarding / interview process at the company where I work. So I was thinking about this in the context of more entry-level folks as well.
I'd suggest updating the prose in your question to something more explicit like: "...by calling the method range? (which we have defined for you as a method in the context of this running example) on a and passing b and c as arguments.
I'd also show people the method signature so they really understand that it's only some custom method you defined here in this example.
@jondkinney I think that's a valid point. We made a small change to the statement following your suggestion.
Agree with @jondkinney.
It would be nice if the editor contained the whole program, not just the line we need to edit.
Being able to view the whole program would give us a more effective way to learn Ruby in its greater context, including what this line of code does. As it's presented to the end user, it's just a blind "copy/paste fire and forget, and have blind faith that everything works without needing to understand any of it".
Wow this question is horribly worded and put together. Took me forever to find out that all I had to do was type in the hint. I was off creating my own methods and solving for STDIN.
This challenge is appalingly undedefined; and that seems to be a general consensus with the only response from Hackerrank is to skip it (instead of them bothering to fix it. D- for customer service)
The input is unexplained and undefined, the output is unexplained. The objective is ambiguously vague, at best. Are we supposed to use some built in method? Are we supposed to extend an existing variable a? I mean, come on. I realize it's rudimentary challenge but have some respect.
And not even all of the test data is actually sent, in fact. If you do in fact read from STDIN you don't get the first two reads/gets(). But there's absolutly no indication that you don't have to read. And also with a method of a.range?(b,c) anyone would presume that you're definining a method on a's class or a's metaclass. The challenge success implementation is in fact neither. It specifically elludes to some method being already written for us, implying the range? method, but that's not true, either.
same here. I was wondering.. how input are processed... it took long time to understand.
not sure if I came to the right place to practice in ruby.
Thank you for sharing your insightful comments. All of you answered my questions regarding '.Range?' .
Your comments were very helpful to my learning.
# write your code here
iter = gets().chomp()
iter = iter.to_i
for loop in 1..iter
line = gets.chomp().split(" ")
a = line.to_i
b = line.to_i
c = line.to_i
**The above code gives error online which is pretty weird
solution.rb:1: warning: constant ::Fixnum is deprecated
solution.rb:13:in range_call': undefined methodchomp' for nil:NilClass (NoMethodError)
from solution.rb:27:in block in <main>'
from solution.rb:25:in `'
range_call': undefined method
block in <main>'
I agree with the others. This question is horribly worded. Doesn't give me much faith in the remainder of Hackerrank's offerings.
Why can't I define my own method names?, it is very confusing
this range? is confusing... how can this method returns true? since a isn't in the range of b and c in the most input cases?