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
PostgreSQLv16

Itt jelenik meg a kód futtatásának eredménye

Tests12
Visible tests
Rejtett teszt 7
Rejtett teszt 8
Rejtett teszt 9
Rejtett teszt 10
Rejtett teszt 11
Rejtett teszt 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