tutorial introduction for line in fprint linethe for loop is one of python' most powerful language features because you can create custom iterator objects and generator functions that supply it with sequences of values more details about iterators and generators can be found later in this and in "functions and functional programming functions you use the def statement to create functionas shown in the following exampledef remainder( , ) / * return /is truncating division to invoke functionsimply use the name of the function followed by its arguments enclosed in parenthesessuch as result remainder( , you can use tuple to return multiple values from functionas shown heredef divide( , ) / * return ( ,rif and are integersq is integer when returning multiple values in tupleyou can easily unpack the result into separate variables like thisquotientremainder divide( , to assign default value to function parameteruse assignmentdef connect(hostname,port,timeout= )function body when default values are given in function definitionthey can be omitted from subsequent function calls when omittedthe argument will simply take on the default value here' an exampleconnect('www python org' you also can invoke functions by using keyword arguments and supplying the arguments in arbitrary order howeverthis requires you to know the names of the arguments in the function definition here' an exampleconnect(port= ,hostname="www python org"when variables are created or assigned inside functiontheir scope is local that isthe variable is only defined inside the body of the function and is destroyed when the function returns to modify the value of global variable from inside functionuse the global statement as followscount def foo()global count count + changes the global variable count lib fl ff