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.
Nice!
Thanks!
Brilliant!
Nice
divmod
usage!Clever!!
Nice
absouloutly clever, I never knew about divmod, I have to keep an eye on it, It has so many use cases.
Nice one!
this is big brain
oooh.. thats really good. I had to google every thing is this code to understand. Hope I can remember it in 20 minutes :D
The
if odd
part is an example of Truthy values in Python - you can learn more here:https://www.freecodecamp.org/news/truthy-and-falsy-values-in-python/
(Not an endorsement of freecodecamp, just the first google search result that looked OK).
In this case, it is a shorter version of
if odd == 1
, which in turn is determined by the remainder calculation in the step above.You can also experiment with this in your IDE: for example try:
You should find that only the first statement will print.
divmod has an amazing user experience level!
Thanks for the comment. I found the following link which helped me https://docs.python.org/2/library/functions.html#divmod
very clever!
i didn't know about divmod() until now!!