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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -