You are viewing a single comment's thread. Return to all comments →
Excellent examples. For #2, I prefer:
print(*sorted(input(), key=lambda c: (c.isdigit(), c.isupper(), c in '02468', c)), sep='')
There is one more element in the tuple but same number of function calls and a little more readable IMO.
Fun stuff!!!
Seems like cookies are disabled on this browser, please enable them to open this website
ginortS
You are viewing a single comment's thread. Return to all comments →
Excellent examples. For #2, I prefer:
print(*sorted(input(), key=lambda c: (c.isdigit(), c.isupper(), c in '02468', c)), sep='')
There is one more element in the tuple but same number of function calls and a little more readable IMO.
Fun stuff!!!