Countdown List
This pattern works like a countdown: start from a larger number and step down to one. Write a function make_pile that takes a number n and returns a list of numbers from n down to 1. If n is 0, return an empty list.
Примеры
Ввод
3Вывод
[3, 2, 1]Ввод
1Вывод
[1]Ввод
0Вывод
[]Нужно реализовать
def make_pile(n: int) -> list[int]:
Теги
listsarraymath
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
3Expected
[3,2,1]2
Input
1Expected
[1]3
Input
0Expected
[]4
Input
5Expected
[5,4,3,2,1]5
Input
2Expected
[2,1]6
Input
-3Expected
[]Focus radio
Paused · SomaFM · Fluid