Skip to content

Instantly share code, notes, and snippets.

@loudambiance
Created December 17, 2021 01:47
Show Gist options
  • Save loudambiance/bb6d265c0c9368aafbf9d09b4b2ef3be to your computer and use it in GitHub Desktop.
Save loudambiance/bb6d265c0c9368aafbf9d09b4b2ef3be to your computer and use it in GitHub Desktop.
fishes = []
with open('task6.txt') as f:
fishes = [int(x) for x in next(f).split(',')]
print ("Initial State: {}".format(','.join([str(x) for x in fishes])))
for days in range(80):
newfish = []
for index,fish in enumerate(fishes):
if fish > 0:
fishes[index] = fish -1
else:
fishes[index] = 6
newfish.append(8)
fishes.extend(newfish)
print("Number of fish: {}".format(len(fishes)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment