Nice! Don’t forget about collections.Counter for part 1! I didn’t know about difflib though. Cool!
Thanks for the hint! Will do that later!
word_twice_count = 0
word_three_times_count = 0
with open('input.txt', 'r') as input_file:
for line in input_file:
line_counter = Counter(line)
if 2 in line_counter.values():
word_twice_count += 1
if 3 in line_counter.values():
word_three_times_count += 1
checksum = word_twice_count * word_three_times_count
print 'checksum is ' + str(checksum)
My edited solution for part one with collections Counter
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.