0

I have a number and I want to create a list, each element having the figures of the aforementioned number.

As an example, I have n=225 and I want to have the list l=[2,2,5].

I can convert the number into a string, then convert the string as a list, like this:

l=list(str(n))
l=[int(i) for i in lst]

But I think there is a better way of doing it. Can you help me?

Bogdan Doicin
  • 2,342
  • 5
  • 25
  • 34

0 Answers0