lating suites as functions which can be parameterized by the arguments they are passed here is the general syntax for creating functiondef functionname(arguments)suite the arguments are optional and multiple arguments must be comma-separated every python function has return valuethis defaults to none unless we return from the function using the syntax return valuein which case value is returned the return value can be just one value or tuple of values the return value can be ignored by the callerin which case it is simply thrown away note that def is statement that works in similar way to the assignment operator when def is executed function object is created and an object reference with the specified name is created and set to refer to the function object since functions are objectsthey can be stored in collection data types and passed as arguments to other functionsas we will see in later one frequent need when writing interactive console applications is to obtain an integer from the user here is function that does just thatdef get_int(msg)while truetryi int(input(msg)return except valueerror as errprint(errthis function takes one argumentmsg inside the while loop the user is prompted to enter an integer if they enter something invalid valueerror exception will be raisedthe error message will be printedand the loop will repeat once valid integer is enteredit is returned to the caller here is how we would call itage get_int("enter your age"in this example the single argument is mandatory because we have provided no default value in factpython supports very sophisticated and flexible syntax for function parameters that supports default argument values and positional and keyword arguments all of the syntax is covered in although creating our own functions can be very satisfyingin many cases it is not necessary this is because python has lot of functions built inand great many more functions in the modules in its standard libraryso what we want may well already be available return statement