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 was baffled by this signature of the
translate
method until I realized "Python" here means Python 2.Most readable of the one-liner solutions I see here.
Fair enough. I love Python, my career revolves around it, but sometimes I just want a little more rigor in the type system! Props to Python 3 for disallowing ordinal comparisons to
None
.I'm guessing by "false extending 0" you mean to point out that
False == 0
? Sure, but take note also thatFalse is not 0
.My point was just that the description (i.e. acceptance criteria) states "when a is close to b, return 0" (type
int
) while this returnsFalse
(typebool
). Python's weak typing in this area makes it easy to be casual. But if you added type annotation to this function and enforced it (say, with mypy or enforce), returningFalse
would be an error.This returns
False
ifa
andb
are equal. (I posted a comment in discourse also, since this suggests the tests need tightening.)This comment is hidden because it contains spoiler information about the solution