In the standard input, the integer N is given on the first line, followed by N integers, and (N + 1) integers are given in the following form.
** Find the maximum value of the integer excluding N on the first line **
N
a_1
...
a_N
** Find the maximum value of (a_1 ... a_n) from the above. ** **
↓ Example of input value
3(N)
7(a_1)
9(a_2)
4(a_N)
↓ Example of output value you want to obtain
9(a_2 =Maximum value)
There are the following two patterns.
** (1) Create a list with N elements 0 **
N = int(input())
#Create a list with N elements 0
A = [0] * N
#Replace the elements entered in the list with 0
for i in range(N):
a = int(input())
A[i] = a
print(max(A))
** (2) Create an empty list **
N = int(input())
#Create an empty list
A = []
#Add a new element to be entered in the list
for i in range (N):
A.append(int(input()))
print(max(A))