TIL: enumerate() exists; no more manual counting

This commit is contained in:
Stefan Harmuth 2020-12-08 09:09:50 +01:00
parent aa5ae674ec
commit b4ff7c58d0

View File

@ -37,9 +37,7 @@ def part1(test_mode=False):
def part2(test_mode=False):
my_input = aoclib.getInputAsArray(day=DAY, test=test_mode)
counter = -1
for check_command in my_input:
counter += 1
for counter, check_command in enumerate(my_input):
if not check_command.startswith('nop') and not check_command.startswith('jmp'):
continue