it is as if the statement temporarily became print( and similarly when executing print( ( ( )the interpreter first evaluates ( and effectively replaces the call by the returned result as if the statement temporarily became print( ( )and then the interpreter evaluates ( and effectively replaces the call by the returned result as if the statement temporarily became print( resulting finally in being calculated and printed python functions can return any type of datanot just numbersand there can be any number of statements executed before the return statement readfollowand run the example program return py ''' function returning string and using local variable'' def lastfirst(firstnamelastname)separator 'result lastname separator firstname return result print(lastfirst('benjamin''franklin')print(lastfirst('andrew''harrington')the code above has new featurevariables separator and result are given value inside the functionbut separator and result are not among the formal parameters the assignments work as you would expect here more on this shortlyin local scope (page details of the execution lines - remember the definition line call the functionremembering where to return line pass the parametersfirstname 'benjamin'lastname 'franklin line assign the variable separator the value ' line assign the variable result the value of lastname separator firstname which is 'franklin''benjamin'which evaluates to 'franklinbenjamin line return 'franklinbenjamin line use the value returned from the function call so the line effectively becomes print('franklinbenjamin')so print it line call the function with the new actual parametersremembering where to return line pass the parametersfirstname 'andrew'lastname 'harrington lines - calculate and return 'harringtonandrew line use the value returned by the function and print 'harringtonandrew defining functions of your own