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.
OP solved it, closing
The last expression is
puts ...
, it returnsnil
.Ruby code-
Below code (as triangle over multiple lines) in string format works. When running tests and submit in CW's its calls 'NilClass' error for the triangle.
The triangle in the example, this is a String class structure?
$triangle =
'1
3 5
7 9 11
13 15 17 19
21 23 25 27 29'
def row_sum_odd_numbers(n)
if $triangle.class == NilClass
return 1
else
new = []
end
end
The problem is that when the ruby translation was created it was misstranslated and since there have been 500+ translations submitted I cannot do anything about it.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Confusing Kata.....From description & looking at tests, if username, password contains // or || or integers this constitutes "wrong user" string. Below code passes all tests but on submit fails some. The fails seem to invalidate the initial description and objective.
What is the objective here in Ruby?
def validate(username, password)
return username.length > username.delete('^a-zA-Z').length || password.length > password.delete('^a-zA-Z').length ? "Wrong username or password!" : "Successfully Logged in!"
end
This comment is hidden because it contains spoiler information about the solution