Cogito interview question

I was asked to sort some examples data using base python.