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

Här visas resultatet av din kod

Tests12
Visible tests
Dolt test 7
Dolt test 8
Dolt test 9
Dolt test 10
Dolt test 11
Dolt 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