python split number to list of single digit 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)
Example 2: how to separate each digit in an integer in python
n = 43365644
digits = [int(x) for x in str(n)]
print(digits)
>>> [4, 3, 3, 6, 5, 6, 4, 4]
lst.extend(digits)
n = 43365644
[(n//(10**i))%10 for i in range(math.ceil(math.log(n, 10))-1, -1, -1)]
>>> [4, 3, 3, 6, 5, 6, 4, 4]