Find All Divisors
Divisors show which numbers can divide n without a remainder. The function divisors receives an integer n and returns a list of all its positive divisors. The result should be sorted in ascending order.
Примеры
Ввод
6Вывод
[1, 2, 3, 6]Ввод
1Вывод
[1]Ввод
12Вывод
[1, 2, 3, 4, 6, 12]Нужно реализовать
def divisors(n: int) -> list[int]:
Теги
mathlists
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteachTests12
Visible tests
Tástáil fholaithe 7
Tástáil fholaithe 8
Tástáil fholaithe 9
Tástáil fholaithe 10
Tástáil fholaithe 11
Tástáil fholaithe 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid