If someone has to much spare time before Christmas
Advent of Code 2016
Advent of Code 2016
Advent of Code 2016
|
If someone has to much spare time before Christmas
Advent of Code 2016
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: 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)) |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Advent of code 2023 | snippsat | 2 | 831 |
Dec-08-2023, 06:52 PM Last Post: snippsat |
|
Advent of Code 2019 | ThomasL | 9 | 5,246 |
Dec-15-2019, 10:54 AM Last Post: ndc85430 |
|
Advent of Code 2018 | snippsat | 0 | 2,618 |
Dec-01-2018, 11:05 PM Last Post: snippsat |
|
Matching emails in outlook 2016 | Erdix | 7 | 4,130 |
Jan-17-2018, 09:36 AM Last Post: Erdix |
|
Advent of Code 2017 | stranac | 5 | 4,840 |
Dec-05-2017, 08:50 AM Last Post: buran |
|
Complete Python Programming Course 2016: Code using Python 3 free udemy course | Yoriz | 0 | 4,256 |
Oct-17-2016, 05:21 PM Last Post: Yoriz |