date;-15/02/2023

s=0

n=int(input(‘enter a number to be checked for being a perfect number’))

# loop to calculate the sum of positive divisors of the given number

for i in range(1,n) # start divisor checking from 1 and go on till n-1

if n%i=0

s+=i

# compare a storing the sum of divisors of n with n

if s==n:

print(n,‘is a perfect number’)

else:

print(n,'is not a perfect number)