DEV Community

saurabh belote
saurabh belote

Posted on

return vs print inside function

reference
https://realpython.com/python-return-statement/

def print_greeting():
    print("Hello, World")


print_greeting()
# outuput : Hello, World


def return_greeting():
    return "Hello, World"

return_greeting()
# output : 

print(return_greeting)
# output :  <function return_greeting at 0x000001C1F88C6950>

print(return_greeting())
# output : Hello, World
Enter fullscreen mode Exit fullscreen mode

Discussion (0)