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.
This comment is hidden because it contains spoiler information about the solution
The test "arr()" fails due to not passing a required parameter into the arr(n) function. Please remove this test or indicate in the test description that the parameter should be optional (this is an 8kyu level test and is going to cause beginners issues).
@voodoonissen What error message does your compiler return when you use an optional argument? I may be mistaken, but I'm 99% sure a
TypeError
is only thrown when a function or operator is used in a way it isn't designed for. The above test given by @valkyrie testsarr()
, with no arguments. Sincearr()
is not designed for this, aTypeError
is thrown. But with an optional argument, it is defined for this type of call. So it does not throw aTypeError
. Where are you saying I'm making a mistake?Another thing is, calling
arr()
is equivalent to callingarr(None)
(correct me if I'm wrong), which is why your solution works. However, if you wanted to setn
to some value other than zero as a default, the code would be a lot more complicated. So, in my opinion, using a default or optional argument is best practice in general.Thank you
Your function name is wrong.
(Also not a issue with the problem)
This comment is hidden because it contains spoiler information about the solution
Description lacks the requirement of function being callable without params though. This needs to be added, just sample test is not enough.
Tests are fine, problem is with your code.
This comment is hidden because it contains spoiler information about the solution