#
# https://pastebin.com/Nasemc0T
#
# Python 3.x
# 1.
# Для теста возьмем конкретную матрицу 8x8.
matrix=[[-35, 115, -45, -25, 1, 83, 13, 53], [119, 128, 31, 124, 66, 126, 63, -1], [-21, 86, 120, 68, 149, 65, -42, 107], [108, 112, 96, 25, 99, 9, 140, 89], [51, 99, 68, 80, 26, 74, 105, -6], [92, 82, 22, 54, 11, 87, -2, -42], [26, -21, 129, 85, 97, 101, 106, 96], [10, -7, -28, 96, 115, 57, -25, 77]]
# Эквивалентно .flatten() для numpy матрицы.
array=list()
for row in matrix: array=array + row
maximum=max(array)
print("#1. Maximum: ", maximum)
# 2.
file="test.txt"
with open(file) as fp:
amount=int(fp.readline())
array=list()
for _ in range(amount):
digit=int(fp.readline())
array.append(digit)
# конец двойно табуляции
maximum=max(array)
print("#2. Maximum: ", maximum)
Скачать вложение Текст (TXT)