Skip to content

Commit

Permalink
Modify for part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-c-anderson committed Dec 12, 2022
1 parent 9809c77 commit cc2d1bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 2022/11/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ def main(data0):

data0 = data0.split('\n\n')

global divide_by_three

if args.part1 or not args.part2:
divide_by_three = True
part1_answer = part1(data0)
print(f'Part 1: {part1_answer}')

if args.part2 or not args.part1:
divide_by_three = False
part2_answer = part2(data0)
print(f'Part 2: {part2_answer}')

Expand Down Expand Up @@ -114,7 +118,9 @@ def process_worry_level(old_worry_level, operation_def):
raise ValueError(f'Unknown operator: {operator}')
# log.debug(f' new_worry_level operated: {new_worry_level}')

new_worry_level = new_worry_level // 3
global divide_by_three
if divide_by_three:
new_worry_level = new_worry_level // 3
# log.debug(f' new_worry_level divided down: {new_worry_level}')

return new_worry_level
Expand Down

0 comments on commit cc2d1bd

Please sign in to comment.