Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ghosts Age by Krzysztof_bonczyk
def checkio(opacity):
fib=[-1]
x=1
y=1
while x<=5000:
fib.append(x)
pom=x
x=x+y
y=pom
i=0
k=1
op=10000
while op!=opacity:
i+=1
if (i in fib):
op-=fib[k]
k+=1
else:
op+=1
print(op)
print(fib)
return i
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(10000) == 0, "Newborn"
assert checkio(9999) == 1, "1 year"
assert checkio(9997) == 2, "2 years"
assert checkio(9994) == 3, "3 years"
assert checkio(9995) == 4, "4 years"
assert checkio(9990) == 5, "5 years"
Nov. 13, 2016