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

Šeit parādīsies koda izpildes rezultāts

Tests12
Visible tests
Slēptais tests 7
Slēptais tests 8
Slēptais tests 9
Slēptais tests 10
Slēptais tests 11
Slēptais tests 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