Divisor Type
A number can be classified by the sum of its proper divisors — all positive divisors except the number itself. Write a function classify_number that returns perfect if the sum equals n, abundant if the sum is greater than n, and deficient if the sum is smaller. This check helps you understand how a number is built from its divisors.
Примеры
Ввод
6Вывод
"perfect"Ввод
12Вывод
"abundant"Ввод
8Вывод
"deficient"Нужно реализовать
def classify_number(n: int) -> str:
Теги
math
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible tests
1
Input
6Expected
"perfect"2
Input
12Expected
"abundant"3
Input
8Expected
"deficient"4
Input
28Expected
"perfect"5
Input
18Expected
"abundant"6
Input
1Expected
"deficient"Focus radio
Paused · SomaFM · Fluid