Inputs are
5 6 7
3 6 10
I'm trying to compare these two vectors and add a tally system to whoever has more. When returning the loop, it gives more than I anticipate.
My code is showing that it iterated three times more than it should have. I am uncertain about the return of the global function. Another thread mentioned a tuple is the result, I don't have that problem.
Alice_wins=0
Bob_wins=0
def compareTriplets(a, b):
global Alice_wins
global Bob_wins
# Write your code here
for ele in a:
for i in b:
if ele>i:
Alice_wins+=1
elif ele<i:
Bob_wins+=1
else:
pass
return Alice_wins, Bob_wins
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
result = compareTriplets(a, b)
fptr.write(' '.join(map(str, result)))
fptr.write('\n')
fptr.close()