Skip to content

Commit

Permalink
make 2 lines into 1
Browse files Browse the repository at this point in the history
  • Loading branch information
raybuhr committed Dec 3, 2021
1 parent 226ccce commit 14114ec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions 2021/py/day03.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ def part_one(data):


def get_rating(data, bit_criteria="O2"):
BIT_CRITERIA = {"O2": operator.eq, "CO2": operator.ne}
op = {"O2": operator.eq, "CO2": operator.ne}[bit_criteria]
df = data.copy()
op = BIT_CRITERIA[bit_criteria]
for i in df.columns:
col_max = df[i].value_counts().idxmax()
if col_max == df[i].value_counts().idxmin():
Expand Down

0 comments on commit 14114ec

Please sign in to comment.