def pibo(num):^M
        if num == 1 or num == 2 :^M
                return 1^M
        else:^M
                return pibo(num-1)+pibo(num-2)^M
^M
#using iteration w/o array (or anytype like array)^M
def piboIter(num):^M
    if num <= 2 :^M
        return 1^M
^M
    a = b = c = 1^M
    for i in range(0, num-2):^M
        c = a + b^M
        a = b^M
        b = c^M
    return c^M
^M
^M
Retrieved from http://wiki.zeropage.org/wiki.php/피보나치/임인택
last modified 2021-02-07 05:31:28