tags:
- code
topic: List
difficulty: Easy
link: https://www.codewars.com/kata/5583090cbe83f4fd8c000051/solutions/python
date: 2023-10-28
Problem
Given a random non-negative number, you have to return the digits of this number within an array in reverse order.
digitize(35231) # returns [1,3,2,5,3]
digitize(0) # returns [0]
def digitize(n):
n = list(str(n))
return [int(i) for i in n[::-1]]
def digitize(n):
return [int(x) for x in str(n)[::-1]]