<jupyter_start><jupyter_text>Day 02Let's get the coins first.<jupyter_code>import aocd
passwords = [{"condition": x.split(": ")[0], "password": x.split(": ")[1]} for x in aocd.get_data(day=2, year=2020).splitlines()]
# print(passwords)<jupyter_output><empty_output><jupyter_text>Part 1<jupyter_code>valid = 0
for password in passwords:
    password["min"] = int(password["condition"].split(" ")[0].split("-")[0])
    password["max"] = int(password["condition"].split(" ")[0].split("-")[1])
    password["character"] = password["condition"].split(" ")[1]
    password["count"] = password["password"].count(password["character"])
    if (password["count"] >= password["min"]) and (password["count"] <= password["max"]):
        valid = valid + 1

print("valid:", valid)<jupyter_output>valid: 434<jupyter_text>Part 2<jupyter_code>valid = 0
for password in passwords:
    if (password["password"][password["min"] - 1] == password["character"]) != (password["password"][password["max"] - 1] == password["character"]):
        valid = valid + 1

print("valid:", valid)<jupyter_output>valid: 509
{'fraction_non_alphanumeric': 0.21691176470588236, 'fraction_numerical': 0.025735294117647058, 'mean_word_length': 6.5625, 'pattern_counts': {'":': 4, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '212275', 'license': 'MIT', 'n_tokens_mistral': 383, 'n_tokens_neox': 360, 'n_words': 68, 'path': '2020/Day02.ipynb', 'repo_name': 'jamesturton/advent_of_code', 'size': '1088'}