sort와 sorted의 차이점
sort와 sorted메서드는 이름은 비슷하지만 서로 다른 역할을 하는 메서드이다. 기본적으로 sort함수는 list 클래스의 메서드로 list객체에서만 사용할 수 있다. 그에 반해 sorted함수는 iterable 객체(list, string, tuple, dictionary 등등...)을 파라미터로 받을 수 있는 메서드이다. 그 외에도 두 메서드간의 몇가지 차이점에 대해 알아보자. sort 메서드 # Syntax: List_name.sort(key, reverse=False) # Parameters: # key: A function that serves as a key for the sort comparison. # reverse: If true, the list is sorted in descend..
2020.09.28