Advent of Code Solutions Thread: Day Two

Only shitty solutions allowed

38
Jump in the discussion.

No email address required.

dont have part 1 but heres my part 2 of day 2

TLM = ["A", "B", "C"]

with open("day2input.txt") as f:
    decisions = f.read()

decisions = decisions.split("\n")

decisions = [tuple(decision.split(" ")) for decision in decisions]

score = 0
for oppo, me in decisions:
    oppo_index = TLM.index(oppo)
    if me == "X":
        score += (oppo_index+2)%3 + 1
    elif me == "Y":
        score += 3
        score += oppo_index + 1
    else:
        score += 6
        score += (oppo_index+1)%3 + 1

print(score)
Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.