How to split user input integer into a list, where each entry is 2 digits?

I'm trying to split an arbitrarily long user input integer into a list where each entry is 2 digits, and if the number has an odd amount of integers, put the only single digit as the first digit. (Where I will then proceed to put a zero in front of it)

I know that putting user integer input into a list looks like:

userintegerlist = [int(i) for i in str(user_input)]
print userintegerlist

And my input (say it's 45346) will look like [4,5,3,4,6]. But I want it to look like: [4,53,46]. Or if input is 68482238, it will be: [68,48,22,38].

Is this possible? All the code is in Python by the way.

Read more here:

Content Attribution

This content was originally published by AndyyRi at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: