idk how to do multi line spoilers lol
letters = ['','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
total_score = 0
team = []
for line in open("input.txt"):
team.append(line.strip())
for i in range(2, len(team), 3):
for letter in team[i]:
if letter in team[i-2] and letter in team[i-1]:
total_score += letters.index(letter)
break
print(total_score)
some real caveman shit but it works
Jump in the discussion.
No email address required.
I'm not doing any additional searches, after the first intersection, the resulting set only has a few characters. That set is then intersected with the third one. It's not like I'm doing a triple for loop.
Jump in the discussion.
No email address required.
the 1st and 2nd half need to be put into sets and intersected, and that intersection should be a set with 1 character. where is this 2nd intersection even coming from?
Jump in the discussion.
No email address required.
2 intersections are for part 2 of the problem. Part 1 is 1 intersection obviously. I don't get what you're confused by.
Jump in the discussion.
No email address required.
More options
Context
ok, i'm a dumbass and just had no idea about the second part. lol. still have no idea what ur code is doing. like what r backpacks?
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context