Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
raybuhr committed Dec 3, 2021
1 parent 9bed7e5 commit 1dfe739
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions 2021/py/day02.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def part_one(data):
depth = 0

for cmd, amt in data:
if cmd == 'forward':
if cmd == "forward":
position += int(amt)
if cmd == 'down':
if cmd == "down":
depth += int(amt)
if cmd == 'up':
if cmd == "up":
depth -= int(amt)

return position * depth
Expand All @@ -29,11 +29,11 @@ def part_two(data):

for cmd, amount in data:
amt = int(amount)
if cmd == 'down':
if cmd == "down":
aim += amt
if cmd == 'up':
if cmd == "up":
aim -= amt
if cmd == 'forward':
if cmd == "forward":
position += amt
depth += aim * amt

Expand All @@ -46,4 +46,3 @@ def part_two(data):
print(part_one(data))
print("*" * 10, "Part Two", "*" * 10)
print(part_two(data))

0 comments on commit 1dfe739

Please sign in to comment.