Last active
October 12, 2018 22:17
-
-
Save twilson90/7f838a6b1ac4a7896a1ac63585595c6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
ans = sys.stdin.readline().split(" ") | |
guess = sys.stdin.readline().split(" ") | |
def count_white(ans, guess): | |
temp_ans = ans[:] | |
pegs = 0 | |
for i in guess: | |
if i in temp_ans: | |
temp_ans.remove(i) | |
pegs += 1 | |
return pegs | |
def count_black(ans, guess): | |
return sum([ans[i] == guess[i] for i in range(len(ans))]) | |
def check(ans, guess): | |
white = count_white(ans, guess) | |
black = count_black(ans, guess) | |
white -= black | |
return str(white)+" "+str(black) | |
sys.stdout.write(check(ans, guess)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment