Help me in solving FIRSTANDLAST problem

My issue

cook your dish here

for i in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
m=
for i in range(n-1):
m.append(a[i]+a[i+1])
print(max(m))

what is wrong in this code…please help

My code

# cook your dish here
for i in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    m=[]
    for i in range(n-1):
        m.append(a[i]+a[i+1])
    print(max(m))

Problem Link: FIRSTANDLAST Problem - CodeChef

you are missing exactly one edge case. Example Input:

2
4
10 4 9 11
3
10 1 10

Your Output:

20
11

Correct Output:

21
20

Try to fix your code yourself. If you are stuck, here is how I would have fixed it:

solution
for i in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    m=[]
    for i in range(n-1):
        m.append(a[i]+a[i+1])
    m.append(a[0]+a[n-1]) #edge case
    print(max(m))