프로그래밍/Baekjoon
(파이썬) 백준 알고리즘 2920번
J_Remind
2018. 12. 5. 23:27
문제
풀이 (Python)
1 2 3 4 5 6 7 8 9 | a = list(map(int, input().split())) if a == sorted(a): print('ascending') elif a == sorted(a, reverse=True): print('descending') else: print('mixed') | cs |
키워드 (Keyword)
sorted
- 리스트를 정렬 (새로운 리스트 리턴 O)
- 디폴트는 오름차순 정렬해주며 내림차순 정렬시 sorted(list,reverse=True)로 사용한다.
참조장삼용, 초보자를 위한 파이썬 200제, 정보문화사(2017)
- 리스트를 정렬 (새로운 리스트 리턴 O)
- 디폴트는 오름차순 정렬해주며 내림차순 정렬시 sorted(list,reverse=True)로 사용한다.
참조장삼용, 초보자를 위한 파이썬 200제, 정보문화사(2017)