def f_max(mas):
i = 0
max_ar = mas[0]
for i in range(len(mas)):
if mas[i] > max_ar:
max_ar = mas[i]
return max_ar
def f_maxIndex(mas):
i = 0
max_ar = mas[0]
for i in range(len(mas)):
if mas[i] < max_ar:
max_ar = mas[i]
return i
def f_min(mas):
i = 0
min_ar = mas[0]
for i in range(len(mas)):
if mas[i] < min_ar:
min_ar = mas[i]
return min_ar
def f_minIndex(mas):
i = 0
min_ar = mas[0]
for i in range(len(mas)):
if mas[i] < min_ar:
min_ar = mas[i]
return i
count = input().split()
array = [int(x) for x in count]
print('Максимальный элемент массива=', f_max(array), ',а его индекс=', f_maxIndex(array))
print('Минимальный элемент массива=', f_min(array), ',а его индекс=', f_minIndex(array))
i
. Она пробежала весь цикл и вернулась.for i in range(len(mas)):
if mas[i] < max_ar:
max_ar = mas[i]
return i
def f_maxIndex(mas):
max_index = 0
max_ar = mas[0]
for i in range(len(mas)):
if mas[i] > max_ar:
max_ar = mas[i]
max_index = i
return max_index
def f_minIndex(mas):
min_index = 0
min_ar = mas[0]
for i in range(len(mas)):
if mas[i] < min_ar:
min_ar = mas[i]
min_index = i
return min_index