Skip to content
Snippets Groups Projects
Commit 5d1b0717 authored by Koffi Gantchou's avatar Koffi Gantchou
Browse files

Upload New File

parent 00505ad7
No related branches found
No related tags found
No related merge requests found
from ap_decorators import count
#@trace
@count
def fibo(n:int)->int:
""" renvoie le terme fn de la suite
Précondition :
Exemple(s) :
$$$
"""
if n==0:
return 0
elif n==1:
return 1
else:
return fibo(n-1) + fibo(n-2)
# en calculant f40 le programme ne s'arrete pas
# >>> fibo(10)
# 55
# >>> fibo.counter
# 186
# >>>
#le calcul de fibo(10) effectue 186 a la fonction fibo
def compter()->list[int]:
""" à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
liste=[]
for i in range(11):
fibo.counter=0
fibo(i)
liste.append(fibo.counter)
fibo.counter=0
fibo(40)
liste.append(fibo.counter)
return liste
#[1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177]
#331160281
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment