Skip to content

Instantly share code, notes, and snippets.

@sampletext32
Created December 24, 2020 15:53
Show Gist options
  • Save sampletext32/e58d86b432eaff6aae530abdf39dfb2c to your computer and use it in GitHub Desktop.
Save sampletext32/e58d86b432eaff6aae530abdf39dfb2c to your computer and use it in GitHub Desktop.
def my_max2(a, b):
if a > b:
return a
else:
return b
if __name__ == "__main__":
m = int(input())
y = []
for i in range(m):
y.append([])
for k in range(m):
y[i].append(int(input()))
maxP = y[0][0]
for i in range(m):
maxP = my_max2(maxP, y[0][i])
maxP = my_max2(maxP, y[i][0])
maxP = my_max2(maxP, y[m - 1][i])
maxP = my_max2(maxP, y[i][m - 1])
maxNP = y[1][1]
for i in range(1, m - 1):
for k in range(1, m - 1):
maxNP = my_max2(maxNP, y[i][k])
print("max1 = {0}".format(maxP))
print("max2 = {0}".format(maxNP))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment