Write a Python Program to Check if a Number is a Perfect Number


Topic: Write a Python Program to Check if a Number is a Perfect Number

Solution

def perfect_no_check(n):
    sum1 = 0
    for i in range(1, n):
        if(n % i == 0):
            sum1 = sum1 + i
    if (sum1 == n):
        return True
    else:
        return False



List all Python Programs