def main(): rel_route_input = "../input" path = local_path(__file__, rel_route_input) values = [int(x) for x in get_lines(path)[0].split(',')] print(get_nth_value(values, 30000000))
def main(): to_input = "../input" path = local_path(__file__, to_input) my_input = parse_input(path) print(multiply_departure(*my_input))
def main(): rel_route_input = "../input" path = local_path(__file__, rel_route_input) instructions = get_lines(path) print(sum_up_values(instructions))
def main(): to_input = "../input" path = local_path(__file__, to_input) config = get_lines(path) print(count_living_cells(config))
def main(): to_input = "../input" path = local_path(__file__, to_input) rules, _, nearby_tickets = parse_input(path) print(sum_up_not_valid_values(rules, nearby_tickets))
def test_first_example(self): to_input = "../smallinput" path = local_path(__file__, to_input) config = get_lines(path) should_be = 112 self.assertEqual(count_living_cells(config), should_be)
def sums_up_correctly(self): rel_route_input = "../smallinput1" path = local_path(__file__, rel_route_input) instructions = get_lines(path) real_sum = 165 self.assertEqual(sum_up_values(instructions), real_sum)
def test_first_example(self): to_input = "../smallinput" path = local_path(__file__, to_input) rules, _, nearby_tickets = parse_input(path) should_be = 71 self.assertEqual(should_be, sum_up_not_valid_values(rules, nearby_tickets))
def test_first_example(self): to_input = "../smallinput2" path = local_path(__file__, to_input) rules, _, nearby_tickets = parse_input(path) valid = valid_tickets(rules, nearby_tickets) should_be = ["row", "class", "seat"] self.assertEqual(fieldnames(rules, valid), should_be)
def test_sums_correctly(self): rel_route_input = '../smallinput2' path = local_path(__file__, rel_route_input) instructions = get_lines(path) mem = write_memory(instructions) s = sum(mem.values()) actual_sum = 208 self.assertEqual(s, actual_sum)
def main(): to_input = "../input" path = local_path(__file__, to_input) prec = {'+': 2, '*': 1} print(sum_exprs(get_lines(path), prec))