Integers to list | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Integers to list

how can an integer be split into a list e. g n=123 so I want n to be split into list that looks like this [1,2,3]

1st Oct 2018, 5:49 PM
‏‪‏‪Sammy_Jamez‬‏‬‏
‏‪‏‪Sammy_Jamez‬‏‬‏ - avatar
1 Respuesta
+ 9
n = 123 nList = list(map(lambda x: int(x), str(n)))
1st Oct 2018, 5:51 PM
Burey
Burey - avatar