andMoonsValue@lemmy.worldtoNews@lemmy.world•Biden Will Try Again to Wipe Out Student Loan Debt for Millions of Borrowers
8·
8 months agoHe literally tried to do this. He tried to push an executive order to go “over the head of different branch(es) of government”.
“What’s stopping him in this specific case?” The Supreme Court stopped him. You know, the judicial branch. It is one of those different branches of government. How did you miss this? It was all over the news.
Python
I’m surprised I don’t see more people taking advantage of
eval
I thought it was pretty slick.import operator import re with open('input.txt', 'r') as file: memory = file.read() matches = re.findall("mul\(\d{1,3},\d{1,3}\)|don't\(\)|do\(\)", memory) enabled = 1 filtered_matches = [] for instruction in matches: if instruction == "don't()": enabled = 0 continue elif instruction == "do()": enabled = 1 continue elif enabled: filtered_matches.append(instruction) multipled = [eval(f"operator.{x}") for x in filtered_matches] print(sum(multiples))