Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compare-the-triplets.py #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions algorithms/compare-the-triplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@

import sys

def solve(a0, a1, a2, b0, b1, b2):
alice = bob = 0
if a0 > b0:
alice += 1
elif a0 < b0:
bob += 1
if a1 > b1:
alice += 1
elif a1 < b1:
bob += 1
if a2 > b2:
alice += 1
elif a2 < b2:
bob += 1
return alice, bob
def compare triplets(a,b):
x=y= 0
nas =[]
for i in range(0,len(a)):
if a[i]>b[i]:
x=x+1
elif b[i]>a[i]:
y=y+1
else:
continue
nas.append(x)
nas.append(y)
return nas



a0, a1, a2 = input().strip().split(' ')
a0, a1, a2 = [int(a0), int(a1), int(a2)]
b0, b1, b2 = input().strip().split(' ')
b0, b1, b2 = [int(b0), int(b1), int(b2)]
result = solve(a0, a1, a2, b0, b1, b2)
print (" ".join(map(str, result)))