3.23. Exercise: Perfect Number 2

“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.” (Wikipedia, Available at: https://en.wikipedia.org/wiki/Perfect_number)

Write a function named is_perfect, takes an integer and returns True if the given integer is perfect, and False otherwise.

Hint: You can define a helper function to decide a number is divisor of another number.

Sample I/O:

>>> is_perfect(6)
True
>>> is_perfect(7)
False
>>> is_perfect(28)
True
>>> is_perfect(30)
False