I am participating in a challenge and one of the challenges was to write a script to sort a list of software versions (ex: 1.0, 1.3.2, 12, 1.3.0). Here is the my solution:
def answer(l): return sorted(l, key=lambda s: [int(i) for i in s.split('.')]) print(answer(eval(raw_input())))
In this code, I am essentially taking the list, and splitting each element by '.', converting them to integers, and then sorting the list. One thought is to use list comprehension to remove lambda altogether, but unsure how to achieve it.