For loop question no 88

def special_func(num):
    total = 0
    if type(num) is int and num > 0:
        total = 1 # 1 is always a factor 
        i = 3 # because 2 will be a even facotor
        while i <= num:
            if num%i == 0 and i%2 != 0:
                total = total + i
            i = i + 1
        return total
        return -10

Why are you considering i =3??

Why are you dividing num%i??

Please clarify.

Please reply to this question


What is the problem with my code??

Please clarify.

Please learn to debug the code by putting print statements. This is the essential art.

You don’t need to ask anyone other than interpreter/compiler if your code is right or wrong.

Yes but i have few questions.

Please answer them.

If you do not answer i will not understand concept.

it will do big trouble to me.