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.
In java, when you divide 2 numbers with the same type, the result has the same type that the operands have.
5 and 9 are ints, so java converts the result of 5/9 (0.5555555556) to an int using half down rounding, resulting in 0.
But, since 5.0 and 9.0 are both floats, the result is also a float by the Java rules, so it does no conversion and the result is 0.555555556.
5/9
is0
.float(5/9)
is0.0
. You probably want to usefloat(5)/9
. i.e. Convert to float before the division.You have to return a number, not a string.
When a parameter is called with an asterisk (*args), it can accept multiple arguments and will return the arguments as a tuple.
If the argument tuple is nested (that is, another array is inside of it) you can call the last element in that array inside the tuple. Array[-1] gets the last item and if that item is a nested array then Array[-1][-1] will be needed to look at last element in that.
Example:
TL;DR It looks at nested items from the tuple argument.
There is no special method for indentation in codewars.
The line number is different because of some preloaded code before your solution.
Which Kata were you doing? Could you post the solution you tried here?
(Use proper formatting for the code), For example
will be rendered as