Published
- 1 min read
perfect number in python
The solution for this is noted below
perfect number in python
Solution
def perfect_number(n):
sum = 0
for x in range(1, n):
if n % x == 0:
sum += x
return sum == n
print(perfect_number(6))
Try other methods by searching on the site. That is if this doesn’t work