Calling a function without return, but there's no None as output | بلاگ

Calling a function without return, but there's no None as output

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

Let's start with foo(x):

def foo(x):
    print(x)

And if I call print(foo(3)), it prints:

3
None

I understand that if no return in function, it's by default return None. But if I use foo(3), it prints:

3

Why there is no output None in foo(3) when I call the function? Is this action, say foo(3), not execution of the function?

asked 19 secs ago
chenghuayang

...
نویسنده : استخدام کار بازدید : 6 تاريخ : دوشنبه 23 بهمن 1396 ساعت: 23:53