Skip to content

Commit 225147c

Browse files
authored
Update practice.py
1 parent a32bf77 commit 225147c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bits_wilp/practice.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,17 @@ def is_prime(num):
3434
print(f"{num} is prime...")
3535

3636
is_prime(7919) # 7919 is prime
37+
38+
39+
def fibo_iter(n_terms):
40+
first, second = 0, 1
41+
for i in range(0, n_terms):
42+
if i <= 1:
43+
result = i
44+
else:
45+
result = first + second
46+
first = second
47+
second = result
48+
print(result, end=' ')
49+
50+
fibo_iter(5) # 0 1 1 2 3

0 commit comments

Comments
 (0)