Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ghosts Age by Mrbond
def checkio(opacity):
fibonachi=[0,1]
a,b=1,2
while a<5000:
a,b=b,a+b
if a<5000:fibonachi.append(a)
number=10000
count=0
while 1:
if count in fibonachi:
number=number-count
if opacity ==number:return count
else:
number+=1
if opacity ==number:return count
count+=1
#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"
June 2, 2014
Comments: