Odpowiedź:
def f_iterative(n):
if n == 1:
return 2
result = 0
prev = 2
current = 0
for i in range(2, n+1):
current = 1 / (2 + prev)
prev = current
return current
Wyjaśnienie:
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
Odpowiedź:
def f_iterative(n):
if n == 1:
return 2
result = 0
prev = 2
current = 0
for i in range(2, n+1):
current = 1 / (2 + prev)
prev = current
return current
def f_iterative(n):
if n == 1:
return 2
result = 0
prev = 2
current = 0
for i in range(2, n+1):
current = 1 / (2 + prev)
prev = current
return current
Wyjaśnienie: