We made it to Day 2 of Advent of Code I have kept my promise for 2 days in a row. As weird as it seems for this day and age, I have kept my promise and today is the day 2 of the Advent of Code, this time with elves involved. There you go, the statement of today's first problem down below: And usual, my solution: import pandas as pd import re import numpy as np filepath = "/content/input 1.txt" with open (filepath, 'r' ) as file : lines = [line.strip() for line in file .readlines()] lines_split = [] for line in lines: token = re.findall(r '\w+|[^\s\w]' , line) lines_split.append(token) blue_list = [] green_list = [] red_list = [] for line in lines_split: blue,green,red = 0 , 0 , 0 for ix, word in enumerate (line): if word == "blue" : if blue < int (line[ix -1 ]): blue = int (line[ix -1 ]) if word == "green" : if green < int (...
Where I post my trips, things I make, and tell you about my learning journey. Expects tonnes of climbing, Arduino, 3D printing and struggles to learn how to code. Hopefully some carpentering too.