DEV Community

saurabh belote
saurabh belote

Posted on

3 2

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

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay