points = 0 p = {"lost": 0, "draw": 3, "won": 6} p2 = {"X": 1, "Y": 2, "Z": 3} sym = {"X": "A", "Y": "B", "Z": "C"} sym2 = {"A": "X", "B": "Y", "C": "Z"} wins = {"C": "X", "A": "Y", "B": "Z"} wins2 = {"A": "Z", "B": "X", "C": "Y"} trans = {"me": {"X": "R", "Y": "P", "Z": "S"}, "enem": {"A": "R", "B": "P", "C": "S"} } with open("input") as f: lines = f.readlines() for line in lines: enem, me = line.split(" ") enem = enem.strip() me = me.strip() print(enem, me) if me == "X": me = wins2[enem] elif me == "Y": me = sym2[enem] elif me == "Z": me = wins[enem] if (sym[me] == enem): points = points + p["draw"] + p2[me] elif (me == "X" and enem == "C"): points = points + p["won"] + p2[me] elif (me == "Y" and enem == "A"): points = points + p["won"] + p2[me] elif (me == "Z" and enem == "B"): points = points + p["won"] + p2[me] else: points += p2[me] print(enem, me) print(points) print() print(points)