Try not to utilize lambda functions when there are built-in ones for the work. Additionally, never utilize the cmp arguments of sorted, the reason is that it's deplored:
sorted(s, key=str.lower)
or
sorted(s, key=str.upper)
But, that won't keep "A" & "a" in order, so:
sorted(sorted(s), key=str.upper)
that will and, by the idea of sorted the activity will be extremely quick for nearly sorted list (the second arranged).
Are you Interested in learning the concepts of python? Join python online course.