def get_input ( input_func , input_str ) : val = input_func ( "Please enter your {0}: " . format ( input_str ) ) while not val or not len ( val . strip ( ) ) : val = input_func ( "You didn't enter a valid {0}, please try again: " . format ( input_str ) ) return val
input a non string into function python
Get input from the user given an input function and an input string
def get_input(input_func, input_str):
    """
    Get input from the user given an input function and an input string
    """
    val = input_func("Please enter your {0}: ".format(input_str))
    while not val or not len(val.strip()):
        val = input_func("You didn't enter a valid {0}, please try again: ".format(input_str))
    return val