반응형
SMALL

주어진 리스트 내 최솟값 구하기 

def min_v(a):
    n = len(a)
    min_v = a[0]
    for i in range(1, n):
        if a[i] < min_v:
            min_v = a[i]
    return min_v

v = [17, 92, 18, 33, 58, 7, 33, 42]
print(min_v(v))

 

 

숫자 n개를 리스트로 입력받아 최솟값 구하기

def min_v(a):
    n = len(a)				
    min_v = a[0]
    for i in range(1, n):
        if a[i] < min_v:
            min_v = a[i]
    return min_v

v = input().split(' ')	
print(min_v(v))
반응형
LIST

+ Recent posts