https://programmers.co.kr/learn/courses/30/lessons/12939
코딩테스트 연습 - 최댓값과 최솟값
문자열 s에는 공백으로 구분된 숫자들이 저장되어 있습니다. str에 나타나는 숫자 중 최소값과 최대값을 찾아 이를 "(최소값) (최대값)"형태의 문자열을 반환하는 함수, solution을 완성하세요. 예를
programmers.co.kr
나의 풀이
def solution(s):
num_list = list(map(int,s.split()))
max_num,min_num = max(num_list),min(num_list)
return str(min_num)+' '+str(max_num)
'Programming > Programmers' 카테고리의 다른 글
[프로그래머스] 행렬의 곱셈 (Python) (0) | 2021.11.07 |
---|---|
[프로그래머스] 피보나치 수(Python) (0) | 2021.11.07 |
[프로그래머스] 숫자의 표현 (Python) (0) | 2021.11.07 |
[프로그래머스] 다음 큰 숫자 (Python) (0) | 2021.11.07 |
[프로그래머스] n진수 게임 (Python) (0) | 2021.11.07 |
댓글