- 1

how can I transform an int (like: 46) into a list of his numerals? (like: [4, 6])

I am creating an simple test to identify even or odd numbers, and this is crucial. any help is welcome :)

4th Aug 2017, 8:25 PM
Samir Salmen
Samir Salmen - avatar
4 Réponses
+ 3
list(str(intNum))
4th Aug 2017, 8:32 PM
J.G.
J.G. - avatar
+ 1
@J.G. ... and then : [int(i) for i in list]
4th Aug 2017, 8:53 PM
clement
clement - avatar
+ 1
thanks!
4th Aug 2017, 8:59 PM
Samir Salmen
Samir Salmen - avatar
0
print(list(str(46)))
4th Aug 2017, 9:03 PM
Tim Thuma
Tim Thuma - avatar