Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Would be better to show more examples
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The method has a different name in the first test buyOrPass instead of buy_or_pass
Anyone know why this doesn't work? I get the error message bad value for range but when I try it in irb it works:
def summation(x)
a = [*1..x]
b = a.inject(0, &:+)
if x.is_a?(Integer)
return b
else
"Invalid Value"
end
end
This comment is hidden because it contains spoiler information about the solution
State that input will be floats or integers as well as postive or negative
Does this code work? It works in my terminal put not on this kata.
def buy_or_pass(stock_price,all_time_high)
a = all_time_high * 0.8
if stock_price < a
'Buy'
else
'Pass'
end
end
Hello all,
I'm a little stuck in my understanding of Ruby. So far I know that 'string'is_a?(String) => true , whereas 12.is_a?(String) => false. But my method isn't working:
def repeat_it(string,n)
string.is_a?(String)
if true
string * n
elsif false
"Not a string"
end
end
This passes everything expect when the method isn't a string I get this message:
Returned unexpected value - Expected: "Not a string", instead got: []
Any advice would be useful. Thanks.