Python abundant, deficient, or perfect number
<pre><code>def classify(numb):
    i=1
    j=1
    sum=0
    for i in range(numb):
        for j in range(numb):
            if (i*j==numb):
                sum=sum+i
                sum=sum+j
            if sum&gt;numb:
                print("The value",numb,"is an abundant number.")
            elif sum&lt;numb:
                print("The value",numb,"is a deficient number.")
            else:
                print("The value",numb,"is a perfect number.")
            break
    return "perfect"
</code></pre>

<p>The code takes a number(numb) and classifies it as an abundant, deficient or perfect number. My output is screwy and only works for certain numbers. I assume it's indentation or the break that I am using incorrectly. Help would be greatly appreciated. </p>

<p>I would highly recommend u to create a one function which creates the proper divisor of given N, and after that, the job would be easy.</p>

<pre><code>def get_divs(n):
    return [i for i in range(1, n) if n % i == 0]


def classify(num):
    divs_sum = sum(get_divs(num))
    if divs_sum &gt; num:
        print('{} is abundant number'.format(num))
    elif divs_sum &lt; num:
        print('{} is deficient number'.format(num))
    elif divs_sum == num:
        print('{} is perfect number'.format(num))
</code></pre>

python for-loop indentation break