We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09e6fd3 commit 9253108Copy full SHA for 9253108
febonacci.py
@@ -0,0 +1,27 @@
1
+def febonacci_without_recurssion(num):
2
+ s = [0,1]
3
+ for index in range(num):
4
+ l = len(s)
5
+ prev1 = s[l-1]
6
+ prev2 = s[l-2]
7
+ s.append(prev1+prev2)
8
+ print(s)
9
+
10
11
+def febonacci_with_recussion1 (a,b,sum,num):
12
+ if num == 0:
13
+ return sum
14
+ next = a+b
15
+ sum += next
16
+ total_sum = febonacci_with_recussion1(b,next,sum, num-1)
17
+ return total_sum
18
19
+def febonacci_with_recussion(a,b,num):
20
21
+ if num == 2:
22
+ return a+b
23
+ small = febonacci_with_recussion(b,next, num-1)+ a
24
+ return small
25
26
27
+print(febonacci_with_recussion(0,1,5))
0 commit comments