def score_symbol(x, y): if x == "A": if y == "X": return 3 if y == "Y": return 1 else: return 2 if x == "B": if y == "X": return 1 if y == "Y": return 2 else: return 3 else: if y == "X": return 2 if y == "Y": return 3 else: return 1 def score_match(x): if x == "X": return 0 if x == "Y": return 3 else: return 6 f = open("input.txt", "r") lines = f.read().splitlines() current = 0 for line in lines: x, y = line.split(" ") current = current + score_symbol(x, y) + score_match(y) print(current)