From b9007b263affce557bd431c411da25a8ea832745 Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 18 May 2019 11:52:30 +0200 Subject: [PATCH] python3: add compare-the-triplets --- python3/compare-the-triplets/__main__.py | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 python3/compare-the-triplets/__main__.py diff --git a/python3/compare-the-triplets/__main__.py b/python3/compare-the-triplets/__main__.py new file mode 100644 index 0000000..9eae1a6 --- /dev/null +++ b/python3/compare-the-triplets/__main__.py @@ -0,0 +1,33 @@ +#!/bin/python3 + +import math +import os +import random +import re +import sys + +# Complete the compareTriplets function below. +def compareTriplets(a, b): + points = {'a':0,'b':0} + + for i in range(3): + if(a[i] > b[i]): + points['a'] += 1 + elif(a[i] < b[i]): + points['b'] += 1 + + return points.values() + +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() \ No newline at end of file