What is the using of return?


#1



Replace this line with your code.


#2

return is the way a function is able to pass a value back to the calling scope. When no value is returned, Python reports this as, None.

def foo(bar):
    print bar

print foo("Bar")
'''
Bar
None
'''

def bar(foo):
    return foo + " => return value"

print bar("Foo")
'''
Foo => return value
'''

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.