최댓값 구하기
def find_max(a):
n = len(a)
max_v = a[0]
for i in range(1, n):
if a[i] > max_v:
max_v = a[i]
return max_v
v = [13, 34, 54, 65, 43, 76, 23]
print(find_max(v))
최솟값 구하기
def find_min(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 = [13, 34, 54, 65, 43, 76, 23, 5]
print(find_min(v))
def find_max_index:
n = len(a)
max_idx = 0
for i in range(1, n):
if a[i] > a[max_idx]:
max_idx = i
return max_idx
v = [13, 34, 54, 65, 43, 76, 23, 5]
print(find_max_index(v))