<reponame>klee30810/TIL_CS
"""
Creater : <NAME>
Updated at : 211004
Reference : sorted function reference
"""

a = ['cde', 'cfccf', 'abcf']

def fn(s):
    return s[0], s[-1]

print(sorted(a))
print(sorted(a,key=fn))
print(sorted(a, key=lambda s: (s[0], s[-1]))) # fn 대신 사용
print(sorted(a, key=len))
"""
Creater : <NAME>
Updated at : 211004
Reference : sorted function reference
"""

a = ['cde', 'cfccf', 'abcf']

def fn(s):
    return s[0], s[-1]

print(sorted(a))
print(sorted(a,key=fn))
print(sorted(a, key=lambda s: (s[0], s[-1]))) # fn 대신 사용
print(sorted(a, key=len))
Creater : <NAME> Updated at : 211004 Reference : sorted function reference # fn 대신 사용