What exactly does the 'return' function do?


wouldn't this code run perfectly without the return?


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.