From 8d22f83bf50ad9f2f8c0b7d4e5577d7d3f99462d Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Sun, 12 Dec 2021 02:41:47 +0000 Subject: [PATCH] day 6 Signed-off-by: Jack Bond-Preston --- 6/6.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 6/6.py diff --git a/6/6.py b/6/6.py new file mode 100644 index 0000000..0c3e490 --- /dev/null +++ b/6/6.py @@ -0,0 +1,19 @@ +day_fish = [0] * 9 + +with open("input.txt") as f: + contents = f.read() + for fish in contents.split(","): + fish = int(fish) + day_fish[fish] += 1 + +print(day_fish) + +days = 256 +for i in range(0, days): + zeros = day_fish[0] + day_fish = day_fish[1:] + [0] + + day_fish[6] += zeros + day_fish[8] += zeros + +print(sum(day_fish)) \ No newline at end of file