input: Write a function to check if a number is a perfect number.
  assert is_perfect_number(6) == True
  assert is_perfect_number(28) == True
  assert is_perfect_number(12) == False
  assert is_perfect_number(496) == True
  assert is_perfect_number(10) == False
output: def is_perfect_number(n):
      if n < 2:
          return False
      divisors_sum = sum(i for i in range(1, n) if n % i == 0)
      return divisors_sum == n