-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproblem7.py
30 lines (26 loc) · 929 Bytes
/
problem7.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
no_of_test_cases = int(input())
output = []
for j in range(no_of_test_cases):
len_of_array = int(input())
arr = [int(x) for x in input("Enter elements separated by comma: ").split(",")]
if len(arr) == len_of_array:
ra_one = 0
g_one = 0
if j % 2 == 0: # for odd numbered test cases, ra_one starts
for i in range(0, len(arr), 2):
ra_one+=arr[i]
for i in range(1, len(arr), 2):
g_one+=arr[i]
if j % 2 != 0: # for even numbered test cases, g_one starts
for i in range(0, len(arr), 2):
g_one+=arr[i]
for i in range(1, len(arr), 2):
ra_one+=arr[i]
# print(g_one)
# print(ra_one)
if g_one > ra_one:
output.append("true")
elif g_one < ra_one:
output.append("false")
for i in range(no_of_test_cases):
print(output[i])