We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
New to Python 3. Just learned about list comprehensions so I'm using them everywhere. Feedback please.
a=[int(x)forxininput().strip().split(' ')]b=[int(x)forxininput().strip().split(' ')]# 1 is a point for Alice, -1 a point for Bobscore=[1ifx>yelse0ifx==yelse-1forx,yinzip(a,b)]print(score.count(1),score.count(-1))
edit: replaced sum() with .count
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
New to Python 3. Just learned about list comprehensions so I'm using them everywhere. Feedback please.
edit: replaced sum() with .count