Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
3-liner: sorted solution in Clear category for Sort Except Zero by przemyslaw.daniel
def except_zero(items):
base = sorted(items, key=lambda x: (-(not x), -x))
return [value and base.pop() for value in items]
Jan. 12, 2020