From 5d1b0717ad0e55de8330da0c36db910112a39e2d Mon Sep 17 00:00:00 2001 From: Koffi Gantchou <koffi.gantchou.etu@univ-lille.fr> Date: Thu, 30 Jan 2025 14:32:29 +0100 Subject: [PATCH] Upload New File --- fibonacy.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 fibonacy.py diff --git a/fibonacy.py b/fibonacy.py new file mode 100644 index 0000000..8dfdebc --- /dev/null +++ b/fibonacy.py @@ -0,0 +1,47 @@ +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 -- GitLab