Skip to content

Commit ccc3365

Browse files
n=int(input())
ls=list(map(int,input().split())) ev,od=0,0 for i in range(0,n): if i%2==0: ev+=ls[i] else: od+=ls[i] if (abs(ev-od))==0: print("YES") else: print("NO")
1 parent 36a8f3c commit ccc3365

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Sum_of_odd_and_even_digits.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
n=int(input())
2+
ls=list(map(int,input().split()))
3+
ev,od=0,0
4+
for i in range(0,n):
5+
if i%2==0:
6+
ev+=ls[i]
7+
else:
8+
od+=ls[i]
9+
if (abs(ev-od))==0:
10+
print("YES")
11+
else:
12+
print("NO")

0 commit comments

Comments
 (0)