๐ ๋ฆฌ์คํธ์์ ์๋ ๋์
๋๋ฆฌ ์ ๋ ฌ
๐ฅ sorted() + lambda
- iterable ์๋ฆฌ์๋ dict, list, str ๊ฐ๋ฅ
- key๋ ์์๋ฅผ ๋น๊ตํ ๋ ์ฌ์ฉ๋๋ ๊ธฐ์ค์ ์ ํ๋ ํจ์
- Reverse = Ture, ๋ด๋ฆผ์ฐจ์
Reverse = False, ์ค๋ฆ์ฐจ์
soreted(iterable, key=None, reverse=false)
-
dictionary case
![](https://velog.velcdn.com/images%2Fhanjoon_10%2Fpost%2F106d7267-f957-462c-ac4b-687680de7011%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202021-07-11%20%EC%98%A4%ED%9B%84%208.58.30.png)
-
tuple case
![](https://velog.velcdn.com/images%2Fhanjoon_10%2Fpost%2Fef3b6731-c9cf-416d-94fb-dc43dc63979a%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202021-07-11%20%EC%98%A4%ED%9B%84%209.12.54.png)
๐ฅ sorted() + itemgetter
![](https://velog.velcdn.com/images%2Fhanjoon_10%2Fpost%2Fdf2b8fa1-614f-4241-90b7-44a6be8eed7c%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202021-07-11%20%EC%98%A4%ED%9B%84%209.46.13.png)
reverse๋ฅผ ์ฌ์ฉํ๋ฉด lambda๋ฅผ ์ฌ์ฉํ์ ๋ ์ ๊ฐ์ด ์ญ์ผ๋ก ์ ๋ ฌ ๊ฐ๋ฅ