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.
To be honest, because I wanted to have a function that only returns ints, but I understand if someone would want to return False instead, or just leave out a return for a
None
, which is also false-y. Therefore, this requirement."truthy" and "falsy" are not a slang, it's more of a terminology used in languages where some non-boolean values can be implicitly coerced to a logical value of
true
orfalse
.For example, in Java there's no such thing, because only
boolean
expressions can have logical value, so you cannot write, for example,if(number % 2)
, you need to explicitly writeif(number % 2 != 0)
. In many languages though some expressions yield a non-boolean value, but it can be implicitly converted to such. For example in Python, empty list, zero, or None are converted toFalse
when used as a logical value, thus they are "falsy". Non-empty list, or numbers other than 0, can be implicitly coverted toTrue
, therefore they are "truthy" values.That being said, the requirement of returnin anything as long as it's falsy is kinda poor one and looks like (much too) literal translation of some code golfing task. In Python, you have explicit
False
, so why the requirement of "return anything as long as it's falsy"?