Python uses whitespaces as delimiters. f(15) is part of the function there. So it's not getting called.
1 2 3 4 5 6 7 8 9 10
|
def f(n):
a=0
b=1
for i in range (0,n):
print (a)
temp=a
a=b
b=temp+b
return a
f(15)
|
Last edited on
Cheraphy wrote: |
---|
Python uses whitespaces as delimiters. |
Continuing with this, you are returning in the loop instead of after it...
1 2 3 4 5 6 7 8 9 10 11 12
|
def f(n):
a=0
b=1
for i in range (0,n):
print (a)
temp=a
a=b
b=temp+b
return a # Return after loop completes...
f(15)
|
Last edited on