def get_int(msgminimumdefault)while truetryline input(msgif not line and default is not nonereturn default int(lineif minimumprint("must be >="minimumelsereturn except valueerror as errprint(errthis function requires three argumentsa message stringa minimum valueand default value if the user just presses enter there are two possibilities if default is nonethat isno default value has been giventhe flow of control will drop through to the int(line there the conversion will fail (since 'cannot be converted to an integer)and valueerror exception will be raised but if default is not nonethen it is returned otherwisethe function will attempt to convert the text the user entered into an integerand if the conversion is successfulit will then check that the integer is at least equal to the minimum that has been specified sothe function will always return either default (if the user just pressed enter)or valid integer that is greater than or equal to the specified minimum rows get_int("rows" nonecolumns get_int("columns" noneminimum get_int("minimum (or enter for )"- default if default minimumdefault minimum maximum get_int("maximum (or enter for str(default")"minimumdefaultour get_int(function makes it easy to obtain the number of rows and columns and the minimum random value that the user wants for rows and columns we give default value of nonemeaning no defaultso the user must enter an integer in the case of the minimumwe supply default value of and for the maximum we give default value of or twice the minimum if the minimum is greater than or equal to as we noted in the previous examplefunction call argument lists can span any number of linesand indentation is irrelevant for their second and subsequent lines