Files
30-seconds-of-code/snippets/digitize.md
Angelos Chalaris 0f36c17995 Update explanations
Update explanation in digitize
Update explanation in delay
Update explanation in curry
Update explanation in compose_right
Update explanation in compose
2020-01-03 13:08:00 +02:00

18 lines
290 B
Markdown

---
title: digitize
tags: math,list,beginner
---
Converts a number to a list of digits.
Use `map()` combined with `int` on the string representation of `n` and return a list from the result.
```py
def digitize(n):
return list(map(int, str(n)))
```
```py
digitize(123) # [1, 2, 3]
```