splitting number into digits python code example
Example 1: splitting a number into digits python
>>> n = 43365644
>>> digits = [int(x) for x in str(n)]
>>> digits
[4, 3, 3, 6, 5, 6, 4, 4]
>>> lst.extend(digits) # use the extends method if you want to add the list to another
Example 2: splitting a number into digits python
>>> n = 43365644
>>> [int(d) for d in str(n)]
[4, 3, 3, 6, 5, 6, 4, 4]
>>>
Example 3: split numbers python
num = 12345
>>> [int(i) for i in str(num)]
[1, 2, 3, 4, 5]