What is perfect number?
In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number. The next perfect number is 28, since 1 + 2 + 4 + 7 + 14 = 28.
perfect-number in python
def is_perfect_number(n):
divisors_sum = sum([x for x in range(1, n) if n % x == 0])
return divisors_sum == n
print(is_perfect_number(28))