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
You can upvote this kata by choosing
Very
in the satisfaction rating.Fixed.
Five years have passed and have not been fixed.
This comment is hidden because it contains spoiler information about the solution
Floats are not odd or even because you can always add a zero at the end.
This comment is hidden because it contains spoiler information about the solution
the trick is that even and odd numbers must be integers by definition, float (which is not integer at the same time) can neither be even nor odd
Thanks. Updated.
Not Sure who you wanted to notify, but Congrats ^_^
Many Ms Man makes some good points.
One line functions are bad functions. Knowing how to read them will help because many people write them.
Don't be worried that you can't comprehend them. Rewrite them on multiple lines using variables and you will find that you can comprehend the logic and what they have done is obfiscate it through their "cleverness". This is the definition of unreadable code. It isn't clever, it's unreadable (not to mention undebuggable).
Always write your code as though you are not going to be the person to maintain it. As much as possible it should be self documenting. If your code becomes difficult to understand because it isn't self describing due to an important consideration like performance, comment it. Instruct people why you have done what you have done.
It is not you who are falling short here. One line code writers without explanatory documentation are bad at what they do.
Thank you :) Yes, I love looking at everyone elses solution and seeing their much more elegant solutions than mine. That's why I'm only 8 kyu though. Very, very 8 kyu.
You do not have to make all your solutions as one-liners. In real applications, I think one-liners are usually bad practice because they tend to be less readable (not always, though).
Those one-liners you see in solutions are mainly for fun, to show a "smart" way of solving things.
However, it is a good idea to learn to read them well, as it will make your code reading skills better.
And to learn to read one-liners, you should try make one yourself :) Vicious circle!
I think it is a good idea to ask questions how a solution works if you cannot comprehend it yourself. It will help you develop your skills faster!
Hmm It is supposed to be a beginner kata.
Sorry, cannot add new tests now - after 500 solutions submitted, test cases are uneditable (this is a CodeWars-wide feature).
Why do you think this is such a special case?
Loading more items...