I found that Python's print
function does not show values sequentially if some values are actually functions that also have print
functions themselves, as in:
def f():
print("function called")
print('hello',f())
# function called
# hello None
I'm really confused why the print function will go to f()
first before printing 'hello'. My expected output is
hello function called
None
My thinking is print()
will first prints 'hello', then it will execute f()
.
Could someone help with this? Thank you so much in advance!