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 37d25d0 commit 0af04d7Copy full SHA for 0af04d7
dynamic_programming/lucas_function
@@ -3,25 +3,25 @@ def lucas_func(n):
3
#PREDFINING THE VALUES
4
a = 2
5
b = 1
6
-
+
7
if n == 0:
8
return a
9
10
- # GENERATING THE NUMBER
+ # GENERATING THE NUMBER
11
for i in range(2, n + 1):
12
c = a + b
13
a = b
14
b = c
15
16
return b
17
18
-# USER INPUT
+# USER INPUT
19
n = int(input("Enter the position n to find the nth Lucas Number: "))
20
print(f"The {n}th Lucas Number is: {lucas_func(n)}")
21
22
"""
23
24
-THE OUTPUT:-
+THE OUTPUT:-
25
Enter the position n to find the nth Lucas Number: 6
26
The 6th Lucas Number is: 18
27
0 commit comments