Trying to print simple fibonacci series in Komodo using Python.
but not getting any o/p
Can someone explain me the mistake.
I’m starting to learn Python. please let me know from where to start. Any link to full python course.
JavaScript
x
12
12
1
#!/usr/bin/env python3
2
# Copyright 2009-2017 BHG http://bw.org/
3
4
# simple fibonacci series
5
# the sum of two elements defines the next set
6
def feb(a,b):
7
a, b = 0, 1
8
while b < 1000:
9
print(b, end = ' ', flush = True)
10
a, b = b, a + b
11
print()
12
Advertisement
Answer
you didn’t call your function. Just call it and also remove parameters as you already assigned them inside your body.
make following changes in your code
JavaScript
1
7
1
def feb():
2
a, b = 0, 1
3
while b < 1000:
4
print(b, end = ' ', flush = True)
5
a, b = b, a + b
6
feb()
7