Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the time it took me to do it by hand I am 100% positive I could have written a Python program to do it probably 3 times.

Yyyyep just tested it:

    def fibs(n, tabs=0):
        if n < 2:
            print "\t"*tabs + "1"
            return 1
        print "\t"*tabs+"fibs %d"%n
        a = fibs(n-1, tabs+1)
        b = fibs(n-2, tabs+1)
        print "\t"*tabs+str(a+b)
        return a+b
Took exactly 71 seconds to write. I probably spent 3 minutes on it by hand getting all the spaces right.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: