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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -