Indentation Error after While Loop in Python -


i have following function, receive indentation error whenever try run it:

def fib(n):         # write fibonacci series n     """print fibonacci series n.""" a, b = 0, 1 while < n: print a, b = b, a+b  # call function defined: fib(2000) 

error message:

print         ^ indentationerror: expected indented block 

how resolve indentationerror error in python?

you need indent code properly. other languages use brackets, python uses indentation:

def fib(n):         # write fibonacci series n     """print fibonacci series n."""     a, b = 0, 1      while < n:         print         a, b = b, a+b 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -