diff --git a/6/6_2.py b/6/6_2.py index 6515cf0..378ea69 100755 --- a/6/6_2.py +++ b/6/6_2.py @@ -7,7 +7,7 @@ def parse_file(file): list_state = [int(x) for x in line.split(',')] - state = dict(zip(range(0, 9), [0]*9)) + state = [0] * 9 for c in range(0, 9): state[c] = list_state.count(c) @@ -36,8 +36,4 @@ DAYS = 256 for d in range(DAYS): iterate(init_state) -lanternfish = 0 -for k, v in init_state.items(): - lanternfish += v - -print(f'There\'s {lanternfish} lanternfish after {DAYS} days') +print(f'There\'s {sum(init_state)} lanternfish after {DAYS} days')