Digitize number
Converts a number to a list of digits.
- Use
map()
combined withint
on the string representation ofn
and return a list from the result.
def digitize(n): return list(map(int, str(n))) digitize(123) # [1, 2, 3]
Converts a number to a list of digits.
map()
combined with int
on the string representation of n
and return a list from the result.def digitize(n): return list(map(int, str(n))) digitize(123) # [1, 2, 3]
A snippet collection of list helpers and tips for Python 3.6.
Initializes a list containing the numbers in the specified geometric progression range.
Finds the median of a list of numbers.
Finds and returns the list of prime factors of a number.