例題2.12_2

等我刷把宗师發表於2024-10-22

例題2.12_2程式碼

def factorial(n):
r = 1
while n > 1:
r *= n
n -= 1
return r
def fib(n):
a, b = 1, 1
while a < n:
print(a, end = ' ')
a, b = b, a + b

相關文章