def test(f):
    for k, v in list(combos.items()):
        print('{} -> {} ({})'.format(v, f(v), 'correct' if f(v) == k else
            'incorrect, should be {}'.format(k)))
Constructing the largest number possible by rearranging a list