perfect number

Solutions on MaxInterview for perfect number by the best coders in the world

showing results for - "perfect number"
Nicolò
07 Jun 2018
1def is_perfect(n):
2  if(n<0):
3    print("n is not a nature number!")
4    return
5  numbers = []
6  for i in range(1,round(n)):
7    if(n%i == 0):
8      numbers.append(i)
9  if sum(numbers) == n:
10    return True
11  else:
12    return False
13n = int(input("your number:"))
14print(is_perfect(n))