<jupyter_start><jupyter_text>[Advent of Code 2020: Day 0](https://adventofcode.com/2020/day/0)  Part One<jupyter_code>import unittest
from IPython.display import Markdown, display

from aoc_puzzle import AocPuzzle

class Puzzle(AocPuzzle):
    
    def parse_data(self, raw_data):
        self.data = list(map(int, raw_data.split('\n')))
            
    def run(self, output=False):
        result = self.data[0]
        if output:
            display(Markdown(f'### Result is `{result}`'))            
        return result
        

class TestBasic(unittest.TestCase):

    def test_parse_data(self):
        in_data = '0\n1\n2'
        exp_out = [0,1,2]
        puzzle = Puzzle(in_data)
        self.assertEqual(puzzle.data, exp_out)
        
    def test_puzzle(self):
        input_data = ['0\n1\n2','2\n3\n4']
        exp_output = [0,2]
        for in_data, exp_out in tuple(zip(input_data, exp_output)):
            puzzle = Puzzle(in_data)
            self.assertEqual(puzzle.run(), exp_out)
        
unittest.main(argv=[""], exit=False)
puzzle = Puzzle("input/d00.txt")
puzzle.run(output=True)<jupyter_output><empty_output><jupyter_text>Part Two<jupyter_code>class Puzzle2(Puzzle):
    def run(self, output=False):
        result = self.data[-1]
        if output:
            display(Markdown(f'### Result is `{result}`'))            
        return result


class TestBasic(unittest.TestCase):
        
    def test_puzzle2(self):
        input_data = ['0\n1\n2','2\n3\n4']
        exp_output = [2,4]
        for in_data, exp_out in tuple(zip(input_data, exp_output)):
            puzzle = Puzzle2(in_data)
            self.assertEqual(puzzle.run(), exp_out)
        
unittest.main(argv=[""], exit=False)
puzzle = Puzzle2("input/d00.txt")
puzzle.run(output=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13580931263858093, 'fraction_numerical': 0.02328159645232816, 'mean_word_length': 2.6912065439672803, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '361241', 'license': 'MIT', 'n_tokens_mistral': 668, 'n_tokens_neox': 638, 'n_words': 110, 'path': 'AoC 2020/AoC 2020 - Day 00.ipynb', 'repo_name': 'RubenFixit/AoC', 'size': '1804'}