+ 6
How to split a number into digits?
How to split a number into digits and add them into the list? Eg, we have 123456 entered, and we need to get the ["1", "2", "3", "4", "5", "6"] list.
4 Respostas
+ 8
I found a simpler option. Maybe it will be useful to someone.
n = int(input()) #123456
lst = list(str(n))
+ 6
You can do it like this too:
n = list(input())
print(n)
+ 3
Almost the same, but shorter:
x = []
for i in input ():
x.append(i)
print(x)
+ 2
num=str (input ())
lists=[]
for i in range (len (num)):
lists.append (num[i])
print (lists)