387 B
387 B
title, type, language, tags, cover, dateModified
| title | type | language | tags | cover | dateModified | ||
|---|---|---|---|---|---|---|---|
| Digitize number | snippet | python |
|
laptop-with-code | 2020-09-15T16:13:06+03:00 |
Converts a number to a list of digits.
- Use
map()combined withinton the string representation ofnand return a list from the result.
def digitize(n):
return list(map(int, str(n)))
digitize(123) # [1, 2, 3]