omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / sort-three-variables / oracle.py
| 1 | # Independent reference for "Sort three variables" (Python 3, standard library only). |
| 2 | # expected.txt is this program's stdout; omc never produced it. |
| 3 | for vals in ([77444, -12, 0], ['lions, tigers, and', 'bears, oh my!', '(from the "Wizard of OZ")']): |
| 4 | for x in (vals, sorted(vals, key=lambda s: s.encode() if isinstance(s, str) else s)): |
| 5 | for name, v in zip("xyz", x): |
| 6 | print(f"{name} = {v}") |