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.
Hey! I found this trick with // and -(-x // y) really interesting for getting floor and ceil without using the math module. Where can I learn more of these kinds of Python tricks or smart coding techniques like this? Any books, courses, or resources you'd recommend? Thanks! 🙌
Such a creative solution.
crack
Interesting.
That's clever!
when you use //, it basically rounds to the smaller number, if you have 1.3 it becomes 1, if you have 79.8, it becomes 79,
so it always round to the smaller, but what happens when the number is negative, -79.8, the smaller number is -80, and that's
the way to do ceil and floor without using any of the method, number // divisor to get the floor, and -(-number//divisor),
to have the ceil, pretty neat :D
thanks for that lesson! ;)
Wow, reading about why it works was educative :D
Rounding towards negative infinity. https://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html
How does this even work?
This comment is hidden because it contains spoiler information about the solution
This is a fantastic solution. Very well done!