Classify by Divisors
A number can be classified by the sum of its proper divisors, which are its positive divisors excluding the number itself. The function classify receives number and returns perfect if the sum equals the number, abundant if the sum is greater, and deficient if the sum is smaller. If number is less than or equal to 0, raise ValueError.
Примеры
Ввод
6Вывод
"perfect"Ввод
28Вывод
"perfect"Ввод
12Вывод
"abundant"Нужно реализовать
def classify(number: int) -> str:
Теги
math
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięTests12
Visible tests
Ukryty test 7
Ukryty test 8
Ukryty test 9
Ukryty test 10
Ukryty test 11
Ukryty test 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