when first programmed in python after having programmed in java and ++one of my favorite features was the ability to return multiple values from function here' simple exampledef () return abc abc (in data analysis and other scientific applicationsyou will likely find yourself doing this very often as many functions may have multiple outputswhether those are data structures or other auxiliary data computed inside the function if you think about tuple packing and unpacking from earlier in this you may realize that what' happening here is that the function is actually just returning one objectnamely tuplewhich is then being unpacked into the result variables in the above examplewe could have done insteadreturn_value (in this casereturn_value would beas you may guessa -tuple with the three returned variables potentially attractive alternative to returning multiple values like above might be to return dict insteaddef () return {'aa'bb'ccfunctions are objects since python functions are objectsmany constructs can be easily expressed that are difficult to do in other languages suppose we were doing some data cleaning and needed to apply bunch of transformations to the following list of stringsstates [alabama ''georgia!''georgia''georgia''florida''south carolina##''west virginia?'anyone who has ever worked with user-submitted survey data can expect messy results like these lots of things need to happen to make this list of strings uniform and ready for analysiswhitespace strippingremoving punctuation symbolsand proper capitalization as first passwe might write some code likeimport re regular expression module def clean_strings(strings)result [ appendixpython language essentials www it-ebooks info