Ordering
sorted, min, max and < need __lt__ ("less than"). Write it, and
sorted(versions) just works.
Writing all of <, <=, > and >= is tedious. Decorate the class with
functools.total_ordering, define __eq__ and __lt__, and it fills in the
rest.
The example sorts version numbers. As strings, "1.10.0" sorts before
"1.9.3", because "1" comes before "9". Comparing tuples of ints gets it
right. Tuples compare item by item, which is why returning a tuple is the
easy way to write any comparison.
In an interview you often don't need __lt__ at all: sorted(items, key=lambda v: v.parts) does the job. You do need it when objects go into
heapq, which compares items directly.
Run it, then add Version("1.10.1") to the list.