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.
can you please explain why number*=10
5/9
is0
.float(5/9)
is0.0
. You probably want to usefloat(5)/9
. i.e. Convert to float before the division.Can someone tell me why float(5/9) is not equal to (5.0/9.0) ? I am using python
You have to return a number, not a string.
This comment is hidden because it contains spoiler information about the solution
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.
what does args[-1][-1] do? I can't find the answer online.
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
Hi! I am learning Python, need help with solving the kata's. Is there a special method for indentation in codewars? I tried 2 or 3 kata's, and i keep getting "unexpected indentation error line 8", when my code was only 3 lines and the indents were fine.
Also I tried copy pasting the solutions just to see if it works, and it doesn't. Please help?