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.
might not need to store all the data in list when you can return value with first occurence.
This comment is hidden because it contains spoiler information about the solution
The operators are already pre-defined.
I don't think having to write out the numbers from 1 to 10 are too much of an issue. It's more of a suggestion.
You are confusing
mod
(the%
operator) withabs
.And yes, this kata needs more tests.
While this may be true for some solutions, there is at least one solution that finishes nearly instantly, no matter the input.
Hey guys, I'm preparing for interview questions and I'm struggling at kyu 4. How hard the interview questions based on codewar question hardness ranking? Thanks!
A couple of people have made the same comment. Luckily C# and Java handle division by zero nicely (returns infinity), so you can return the result directly. For Python, I specified that you should return None, since it will otherwise result in an exception.
It's meant to be very simple so I don't think there is any way to make this more interesting without changing the concept (i.e. using something besides math operations). You could make your own kata with a more intersting idea.
It does not make sense that division by 0 should result in 0 - in fact, in mathematical terms it could result in any number up to infinity. I think you should not test for division by 0, or at least have an error be saved in the result variable, e.g. 'Zero Division'
There is a lot of writing out dictionaries, maybe you could include this in the given code?
This comment is hidden because it contains spoiler information about the solution
It would make more sense for the modulus dunction to take only one variable, not 2. Also, it would be helpful if the function of some functions, such as the exponential function, were made clearer.
Same test since the beginning.
I have the same problem in python when trying to submit.
I guess tests are using a combination of k and n values which is a bit too big for float :(
I tried to use Decimal to wrap the failling calculation, and convert back the result to float - but I get back a systematic timeout from codewars.
But what is strange is that 161 of 772 of completed katas are in python ... so I guess there is a way to overcome that if nothing has changed recently.
overflow error??!!
Loading more items...