본문 바로가기
Beakjoon&프로그래머스/파이썬

[프로그래머스/파이썬] 피보나치 수

by 현장 2022. 5. 17.

-Code

def solution(n):
    a, b = 0, 1
    if n == 0:
        return a
    for i in range(n - 1):
        temp = a
        a = b
        b = a + temp
    return b