Skip to content

Latest commit

 

History

History
51 lines (28 loc) · 577 Bytes

Convert_number_to_reversed_array_of_digits.md

File metadata and controls

51 lines (28 loc) · 577 Bytes

CodeWars Python Solutions


Convert number to reversed array of digits

Given a random number you have to return the digits of this number within an array in reverse order.

Example

348597 => [7,9,5,8,4,3]

Given Code

def digitize(n):
    return

Solution 1

def digitize(n):
    return [int(x) for x in str(n)[::-1]]

Solution 2

def digitize(n):
    return list(map(int, str(n)))[::-1]

See on CodeWars.com