defining functions you can see how distance is called three times in one line to compute the perimeter of the triangle using function here saves quite bit of tedious coding sometimes function needs to return more than one value this can be done by simply listing more than one expression in the return statement as silly examplehere is function that computes both the sum and the difference of two numbers def sumdiff( , )sum diff return sumdiff as you can seethis return hands back two values when calling this functionwe would place it in simultaneous assignment num num eval(input("please enter two numbers (num num ")sd sumdiff(num num print("the sum is" "and the difference is"das with parameterswhen multiple values are returned from functionthey are assigned to variables by position in this examples will get the first value listed in the return (sum)and will get the second value (diffthat' just about all there is to know about value-returning functions in python there is one "gotchato warn you about technicallyall functions in python return valueregardless of whether or not the function actually contains return statement functions without return always hand back special objectdenoted none this object is often used as sort of default value for variables that don' currently hold anything useful common mistake that new (and not-so-newprogrammers make is writing what should be value-returning function but forgetting to include return statement at the end suppose we forget to include the return statement at the end of the distance function def distance( )dist math sqrt(square( getx( getx()square( gety( gety())running the revised triangle program with this version of distance generates this python error messagetraceback (most recent call last)file "triangle py"line in main(file "triangle py"line in main perim distance( , distance( , distance( , typeerrorunsupported operand type(sfor +'nonetypeand 'nonetypethe problem here is that this version of distance does not return numberit always hands back the value none addition is not defined for none (which has the special type nonetype)and so python complains if your value-returning functions are producing strange error messages involving nonecheck to make sure you remembered to include the return