Create 6.py
This commit is contained in:
18
Gareth solution Python/6.py
Normal file
18
Gareth solution Python/6.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#it is very not efficient for pt2 but I didn't have much time today to think of a better solution
|
||||
fish = [2,3,1,3,4,4,1,5,2,3,1,1,4,5,5,3,5,5,4,1,2,1,1,1,1,1,1,4,1,1,1,4,1,3,1,4,1,1,4,1,3,4,5,1,1,5,3,4,3,4,1,5,1,3,1,1,1,3,5,3,2,3,1,5,2,2,1,1,4,1,1,2,2,2,2,3,2,1,2,5,4,1,1,1,5,5,3,1,3,2,2,2,5,1,5,2,4,1,1,3,3,5,2,3,1,2,1,5,1,4,3,5,2,1,5,3,4,4,5,3,1,2,4,3,4,1,3,1,1,2,5,4,3,5,3,2,1,4,1,4,4,2,3,1,1,2,1,1,3,3,3,1,1,2,2,1,1,1,5,1,5,1,4,5,1,5,2,4,3,1,1,3,2,2,1,4,3,1,1,1,3,3,3,4,5,2,3,3,1,3,1,4,1,1,1,2,5,1,4,1,2,4,5,4,1,5,1,5,5,1,5,5,2,5,5,1,4,5,1,1,3,2,5,5,5,4,3,2,5,4,1,1,2,4,4,1,1,1,3,2,1,1,2,1,2,2,3,4,5,4,1,4,5,1,1,5,5,1,4,1,4,4,1,5,3,1,4,3,5,3,1,3,1,4,2,4,5,1,4,1,2,4,1,2,5,1,1,5,1,1,3,1,1,2,3,4,2,4,3,1]
|
||||
day = 0
|
||||
index = 0
|
||||
while True:
|
||||
if day == 256:
|
||||
break
|
||||
if index == len(fish):
|
||||
index = 0
|
||||
day = day + 1
|
||||
print("Day",day)
|
||||
if fish[index] == 0:
|
||||
fish[index] = 6
|
||||
fish.append(9)
|
||||
elif fish[index]!=0:
|
||||
fish[index]= fish[index]-1
|
||||
index = index + 1
|
||||
print("Number fo fish ",len(fish))
|
||||
Reference in New Issue
Block a user