Created
December 17, 2021 01:47
-
-
Save loudambiance/bb6d265c0c9368aafbf9d09b4b2ef3be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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