Write a Python Program to Check If Two Numbers are Amicable Numbers


Topic: Write a Python Program to Check If Two Numbers are Amicable Numbers

Solution

def amicable_no_check(x, y):
    sum1=0
    sum2=0
    for i in range(1,x):
        if x%i==0:
            sum1+=i
    for j in range(1,y):
        if y%j==0:
            sum2+=j
    if(sum1==y and sum2==x):
        return True
    else:
        return False



List all Python Programs