Digits in Reverse
Sometimes you need to break a number into separate digits so you can work with them as a list. Write digitize, which takes a non-negative number n and returns its digits in reverse order. That means the last digit comes first, then the digit before it, and so on.
Примеры
Ввод
35231Вывод
[1, 3, 2, 5, 3]Ввод
0Вывод
[0]Ввод
123Вывод
[3, 2, 1]Нужно реализовать
def digitize(n: int) -> list[int]:
Теги
mathlistsarray
Prijavite se za ogled zgodovine oddaj
PrijavaPrijavite se za uporabo mentorja UI
PrijavaVisible tests
1
Input
35231Expected
[1,3,2,5,3]2
Input
0Expected
[0]3
Input
123Expected
[3,2,1]4
Input
1Expected
[1]5
Input
1000Expected
[0,0,0,1]6
Input
999999Expected
[9,9,9,9,9,9]Focus radio
Paused · SomaFM · Fluid