compare return py and addition pyfrom the previous section both use functions both printbut where the printing is done differs the function sumproblem prints directly inside the function and returns nothing explicitly on the other hand lastfirst does not print anything but returns string the caller gets to decide what to do with the stringand above it is printed in the main program open addition py againand introduce common mistake change the last line of the function main inserting printso it says print(sumproblem(ab)then try running the program the desired printing is actually done inside the function sumproblem you introduced statement to print what sumproblem returns although sumproblem returns nothing explicitlypython does make every function return something if there is nothing explicitly returnedthe special value none is returned you should see that in the program' shell output this is fairly common error warningif you see 'nonein your printed output where you do not expect itit is likely that you have printed the return value of function that did not return anything explicitlyin generalfunctions should do single thing you can easily combine sequence of functionsand you have more flexibility in the combinations if each does just one unified thing the function sumproblem in addition py does two thingsit creates sentenceand prints it if that is all you haveyou are out of luck if you want to do something different with the sentence string better way is to have function that just creates the sentenceand returns it for whatever further use you want printing is one possibilitydone in addition py'''display sum problems with function returning stringnot printing directly ''def sumproblemstring(xy)sum return 'the sum of {and {is {format(xysumdef main()print(sumproblemstring( )print(sumproblemstring( ) int(input("enter an integer") int(input("enter another integer")print(sumproblemstring(ab)main(quotient string return exercise create quotientreturn py by modifying quotientprob py in quotient function exercise (page so that the program accomplishes the same thingbut everywhere change the quotientproblem function into one called quotientstring that merely returns the string rather than printing the string directly have the main function print the result of each call to the quotientstring function two roleswriter and consumer of functions the remainder of this section covers finer points about functions that you might skip on first reading we are only doing tiny examples so far to get the basic idea of functions in much larger programsfunctions are useful to manage complexitysplitting things up into logically relatedmodest sized pieces programmers are both beginning with python