>>> for data in ([2, 1, 0], [2.2, 1.1, 0], "quick_sort"): ... quick_sort(data) == sorted(data) True True True
(data: list)
| 1 | def quick_sort(data: list) -> list: |
| 2 | """ |
| 3 | >>> for data in ([2, 1, 0], [2.2, 1.1, 0], "quick_sort"): |
| 4 | ... quick_sort(data) == sorted(data) |
| 5 | True |
| 6 | True |
| 7 | True |
| 8 | """ |
| 9 | if len(data) <= 1: |
| 10 | return data |
| 11 | else: |
| 12 | return [ |
| 13 | *quick_sort([e for e in data[1:] if e <= data[0]]), |
| 14 | data[0], |
| 15 | *quick_sort([e for e in data[1:] if e > data[0]]), |
| 16 | ] |
| 17 | |
| 18 | |
| 19 | if __name__ == "__main__": |
nothing calls this directly
no outgoing calls
no test coverage detected