Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ghosts Age by mijalskihubert
def checkio(opacity):
f1=1
f2=1
wynik=10000
wiek=0
while(wynik!=opacity):
wiek+=1
if(wiek==f2):
wynik-=f2
pom=f2
f2=f2+f1
f1=pom
else:
wynik+=1
return wiek
#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(3703) == 4665, "4 years"
#assert checkio(9990) == 5, "5 years"
Nov. 1, 2016