Skip to content

Commit b997794

Browse files
committedMay 10, 2021
additional (advanced ) topic added + Cheatsheet
1 parent 89b4994 commit b997794

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+570
-1
lines changed
 

‎10. Generators/fibonacci_list.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
def fib(num):
3+
a = 0
4+
b= 1
5+
li=[]
6+
for i in range(num):
7+
li.append(a)
8+
temp = a
9+
a = b
10+
b = temp + b
11+
print(li)
12+
13+
num = int(input("Enter a number: "))
14+
fib(num)

‎10. Generators/fibonacci_range.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
def fib(num):
3+
a = 0
4+
b= 1
5+
for i in range(num):
6+
yield a
7+
temp = a
8+
a = b
9+
b = temp + b
10+
11+
num = int(input("Enter a number: "))
12+
13+
for i in fib(num):
14+
print(i)

0 commit comments

Comments
 (0)
Please sign in to comment.