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.
I didn't at once guess to combine single and double quotation marks.
This is beautiful
gauss gang rise up!
Very unique
this solution is so elegant
The problem is with big numbers: first a float division is made, and then only
math.floor
is applied to the result, but floats have a limited precision, so the final result is wrong. You can find more details there: https://python-forum.io/thread-9009.htmlcan someone explain me why is // work but floor import from math have totally different results?
You know when you see something so simple.
And it makes so much sense.
And you missed it when you were solving the problem.
This is that 🤦♂️
@natan and @dolamroth thanks for clearing my doubt
I already Checked the solution in my kata solution it's working fine. I have an issue that the output of math. float(div) and int(div) and floor division are the same in small values but it's failing in large number value so I just asked in this answer. I cant do this in forked beacuse its gonaa faill
Don't make this answer a spoiler.
so many people have the same doubt as me so from this they easily understand why these things did not work here only floor division (//) work.
That was the case in python 2 as well though wasn't it?
They visibly changed their python type, but that is a mostly cosmetic difference.
Integers in Python 3 are by default not bounded, i.e. memory is allocated dynamically upon request. However, floats are limited to double precision (64 bits), so there are rounding errors.
look at the values involved in the failing tests
you need to be able to exactly represent them through all your intermediary results
in general, if something has to do with integers then you shouldn't ever involve float and if you "accidentally" get a float the answer is never to convert it back to int
I marked your post as containing spoilers.
When you test out the solutions of other people, please do so in a fork. Right now you have THIS solution as YOUR solution since you ran it in the kata itself.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution