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.
If you want to include testing for default arguments, or optional arguments, that's fine; but in that case it might be a good idea to mention this in the instructions...
Below you mean. Whoops, closed on accident. Author has to approve it.
I can't change main idea. Only translate. Probably this test show your understanding default arguments.
What is the point of this test: test.assert_equals(arr(), []) ??????
Gotcha, thanks!
Not exactly... when python creates a list (or string), it automatically saves its length. Finding the length is a single operation, not a loop through its elements. So no need to save it, and it's always O(1) complexity, no matter the length itself.
read more comments here:
https://stackoverflow.com/questions/699177/python-do-python-lists-keep-a-count-for-len-or-does-it-count-for-each-call
why not just assign the lengths of "l" and "d" to variables. This calculates the lengths of "d" and "l" 4 times.
I know the lengths of them are quite small in this kata, but still this doesn't seem efficient.
Oh man, that's way simpler than what I did.
Nailed it!
yep I guess I'm doing some basic mistake that I haven't figured out yet, but got some hints from you.. let me think about it a bit longer, problem must be on my side as no one else reporting this issue.. Thank you both, I'll confirm once solved :D.
You're probably not returning the recursive call to your function.
Solved?
Thank you for reply.
Nah, I have this inside my code..
So it's returning as well..
You're supposed to return the stuff which you consider as your answer, you're logging them right now.
What am I doing wrong? When I console.log the result is correct, but the test response is undefined :-/. Thank you..
Time: 941ms Passed: 0 Failed: 4 Exit Code: 1
Test Results:
Basic tests
Log
[ 6, 7 ]
Expected: [6, 7], instead got: undefined
Log
[ 0, 1 ]
Expected: [0, 1], instead got: undefined
Log
[ 0, 1 ]
Expected: [0, 1], instead got: undefined
Log
[ 2, 2 ]
Expected: [2, 2], instead got: undefined
Completed in 5ms
STDERR
Unhandled rejection TestError: Expected: [6, 7], instead got: undefined
Loading more items...