Dec-03-2016, 10:27 PM
Dec-03-2016, 10:30 PM
Mine for Advent of Code day 3:
sides = [list(map(int, line.split())) for line in open("input.txt")] print([sum(i) > 2 * max(i) for i in sides].count(True))
Dec-06-2016, 01:50 AM
There are some fun and original task in Advent of Code.
Mine for day 5:
Mine for day 5:
import hashlib def hash_find(): hash_lst = [] i = 0 while len(hash_lst) < 8: make = 'cxdnnyjw{}'.format(i) i += 1 if hashlib.md5(str.encode(make)).hexdigest().startswith('00000'): hash_lst.append(hashlib.md5(str.encode(make)).hexdigest()) return(hash_lst) def password(hash_find): print(''.join(i[5] for i in hash_find())) if __name__ == '__main__': password(hash_find)
Dec-06-2016, 10:00 PM
Mine for Advent of Code day 6:
from collections import Counter def adv_6(): with open('input_adv_6.txt') as f: data = [i.strip() for i in f] lenght_x = len(data[0]) rows = [[i[c] for i in data] for c in range(lenght_x)] return ''.join([Counter(i).most_common(1)[0][0] for i in rows]) if __name__ == '__main__': print(adv_6())
Dec-06-2016, 10:35 PM
I also used Counter for #6:
import collections columns = [] with open("input.txt") as fin: for line in fin: for ndx, ch in enumerate(line): if ndx >= len(columns): columns.append([]) columns[ndx].append(ch) answer = [collections.Counter(col).most_common(1)[0][0] for col in columns] print(''.join(answer))