I write the following code in Python:
def fib(n):
a, b = 0, 1
while b < n:
print(b, end=' ')
a, b = b, a + b
print(fib, fib(10))
I think the correct output should be:
<function fib at 0x000001DF4BB13E18> 1 1 2 3 5 8
But The output is:
1 1 2 3 5 8 <function fib at 0x000001C60F823E18> None
The code prints None and its behavior is odd.
Why behavior of print
function is odd?