Return

Roland Mueller roland.em0001 at googlemail.com
Tue Dec 7 15:45:18 EST 2021


Hello

ti 7. jouluk. 2021 klo 19.47 vani arul (arulvani66 at gmail.com) kirjoitti:

> Hey There,
> Can someone help to understand how a python function can return value with
> using return in the code?
> It is not not about explicit or implicit function call.
>
>
Not sure whether I understood your question: I have a simple example about
return.
  * f() and h() explicitely return something
  * g() and h() return None

BTW, also Python documentation tool pydoc has an article about return.

#!/usr/bin/python

def f():
    return 42
def g():
    pass
def h():
    return

if __name__ == "__main__":
    print(f"f(): {f()}")
    print(f"g(): {g()}")
    print(f"h(): {h()}")

Result:
f(): 42
g(): None
h(): None

Pydoc:
$ pydoc return

BR,
Roland


> Thanks
> Vani
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list