반응형
반응형

 

상황

max()와 min() 함수를 사용하다 ValueError: max() arg is an empty sequence 에러 메세지가 떳습니다.

더 다세하게는 아래 코드를 확인해주세요~

def solution(x):
    arr = map(int, x.split())
    return str(min(arr)) + " " + str(max(arr))

 

arr의 type을 확인한 결과 <class 'map'>인걸 확인헀습니다.

그리고 min() 또는 max()를 사용 후 arr안에 있는 값을 꺼낼 수 없다는 것을 확인했습니다.

 

해결

- map()을 list()로 감싸서 list 형태로 만듭니다.

 

 

반응형

'Python' 카테고리의 다른 글

zip()  (0) 2023.05.03
combinations()  (0) 2023.05.03
[panda]info()  (0) 2023.04.26
cannot import name 'fl_score' from 'sklearn.metrics'  (0) 2023.04.26
IndentationError: unindent does not match any outer indentation level  (0) 2023.04.25

+ Recent posts