Write a function that returns a digit conversion function. The returned function takes a positive integer and returns a new integer where each digit of that passes the test () is replaced by its conversion . Digits of that do not pass the test are to be left unchanged by the digit conversion function.
Let us insist that the digit conversion function described is not the required proper, but its output.
>>> conv_dig_func = conv_dig(lambda d: d % 2 == 0, lambda d: d // 2) >>> conv_dig_func(21098) 11094 >>> conv_dig_func(1032547698) 1031527394 >>> conv_dig_func = conv_dig(lambda d: d < 5, lambda d: 2) >>> conv_dig_func(1064592) 2262592 >>> conv_dig_func(9876543210) 9876522222