Completed first day successful
This commit is contained in:
21
Day0/doorTwo.py
Normal file
21
Day0/doorTwo.py
Normal file
@@ -0,0 +1,21 @@
|
||||
file = open('/Users/mastermito/Dev/AdventOfCode/Day0/input.txt', 'r')
|
||||
|
||||
#start of dial
|
||||
number = 50
|
||||
#counter for zeros
|
||||
counter = 0
|
||||
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
step = int(line[1:])
|
||||
direction = 1 if line.startswith('R') else -1;
|
||||
|
||||
for singleStep in range(step):
|
||||
number = number + direction
|
||||
number = number % 100
|
||||
if number == 0:
|
||||
counter += 1
|
||||
|
||||
print('counter:', counter)
|
||||
|
||||
file.close()
|
||||
Reference in New Issue
Block a user