def sub(number):
tmp = []
tmp.append(number)
while len(str(number)) > 1:
tmp.append(int(str(number)[:-1]))
number = int(str(number)[:-1])
return tmp
In this function I try to make this output, something like this:
Input: 1234
output: [1234, 123, 12, 1]
Now my question is there any more efficient way to do this in python?