Calculate the difference between the ``maximum integer value'' and the ``minimum integer value'' that can be obtained by rearranging the numbers of each digit for a positive integer value of 4 digits or less to create the next integer value. For a positive integer value of 4 digits or less, if you repeat the operation to create the next integer value by calculating the difference between the "maximum integer value" and the "minimum integer value" that can be obtained by rearranging the numbers of each digit , always converges to some integer value. Enter a positive integer value n of 4 or fewer digits in the command line input. Create a program that repeats the above calculation and outputs the integer values until convergence to the standard output.
def func(n): while True: ints = list(map(int, str(n))) n = max(ints) - min(ints) print(n) if n <= 5: break func(1234)