Attached picture related to return value
In the attached picture, I am wondering why there are two results? Is it due to the def function derive one and the print function derive another one? Thank you!
Attached picture related to return value
In the attached picture, I am wondering why there are two results? Is it due to the def function derive one and the print function derive another one? Thank you!
By default, a function automatically returns None:
def f():
pass
>>> print(f())
None
You can, of course, specify other return values:
def f():
return 42
>>> print(f())
42
In your example, the function prints a value and returns None. The second print then displays the None. There are two prints -- that is why you see two values printed.