You are reading a single comment by @Greenbank and its replies.
Click here to read the full conversation.
-
I thought about make a map of possibilities, ended up doing this:
def part2(game: list[str, str]) -> int: offset = ord("A") score_dict = { "X": ((ord(game[0]) - offset - 1) % 3) + 1, "Y": ord(game[0]) - offset + 4, "Z": ((ord(game[0]) - offset + 1) % 3) + 7, } return score_dict[game[1]]
Probably less readable overall though
Yeah, I just smashed the input strings into a map, e.g.
Didn't even have to parse/split the incoming string.