What exactly does the 'return' function do?


#1


wouldn't this code run perfectly without the return?


#2

return is not a function, but it serves as a channel between function scope and calling scope through which data can be handed back to the caller. When there is no return value, or no explicit return statement, Python responds in the console with None.

We pass data to a function through its parameters, and back to the caller through its return statement.