I wish to write a Python program that gets a number from the keyboard, and outputs a number built from the minimum of each pair of digits of the original number. For example:
Enter number please: 84372216
Original number: 84372216
New number: 4321
I had an idea to transform the original number into a string, to create a list of digits (chars) in the odd locations and the even locations, and then to compare them by the index of the lists. This doesn't sound too efficient or easy to implement, as it involves too many conversions from int to string and vice versa. The advantage is that this solves easily the problem of a number with odd number of digits.
Is there a way of solving this problem without using strings ?
Thank you.