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.
This comment is hidden because it contains spoiler information about the solution
(Deleted)
(Solved in the new fork)
IMHO it breaks the 3rd zen rule of Python. At least the return expression.
reverse
is a boolean flag that indicates if resulting array should be sorted in ascending order from min to max, or reversed from max to min.i%2
is an int with value0/1
.In Python, an integer can also be evaluated as a boolean.
The convention is the following:
Based on this conversion rule:
i % 2 == 0
, thenreverse == False
, thus array is sorted in ascending order.i % 2 == 1
, thenreverse == True
, thus array is sorted in descending order.