Find the sum of all the divisor of a number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Find the sum of all the divisor of a number.

What's up guys? I would like please your help with a problem that I'm trying to resolve by using while loop in order to «return the sum of all the divisors of a number, without including it», we haven't reached for loops, f strings, import modules, etc, basically I would like to know how to do it by using while loop, if, elif or else, something simple and of course to know and understand what I am doing, so far I was trying to use while n%var == 0 and n%var != n, sorry , my mind goes blank after that, see you guys and thank you!

1st Jul 2020, 9:31 PM
Whally O.
Whally O. - avatar
11 Answers
+ 1
Great, enjoy your nap, thanks
1st Jul 2020, 10:19 PM
Whally O.
Whally O. - avatar
+ 1
Bagon it was all good and perfect, thank you very much!
5th Jul 2020, 10:05 PM
Whally O.
Whally O. - avatar
+ 1
Thank you! 🥃🍻🍺 Bagon
5th Jul 2020, 10:12 PM
Whally O.
Whally O. - avatar
0
Thank you, but what about without lists [] or append, something that only uses a defined function, variables, while loop, if - else statements, and-or, don't get me wrong, it's very good what you just shared with me, but I'm looking for a way to do it with the things that I mentioned
1st Jul 2020, 10:02 PM
Whally O.
Whally O. - avatar
0
You're fast man! 😆 , I was looking the code and then suddenly changed
1st Jul 2020, 10:09 PM
Whally O.
Whally O. - avatar
0
One question, please, do I need to declare this: number = int(input('Enter a number: ')) ?
1st Jul 2020, 10:12 PM
Whally O.
Whally O. - avatar
0
Can I send you my version when I finish?
1st Jul 2020, 10:17 PM
Whally O.
Whally O. - avatar
0
Sorry, how do I put that when 'num' is 0 should return 0, instead is returning 1, I was trying to add an elif but is not working, thanks
1st Jul 2020, 11:05 PM
Whally O.
Whally O. - avatar
0
https://code.sololearn.com/cTNra1Yweqg9/?ref=app I tried to do what you said or something like that yesterday and is showing me the error that 2 is returning 3, I verified with 4 and is returning 3 as well, f...! , whenever you have time give it a look, please
2nd Jul 2020, 7:28 PM
Whally O.
Whally O. - avatar
0
Bagon, what's up? Ok I'll try again to see how it goes through, thank you
3rd Jul 2020, 9:08 AM
Whally O.
Whally O. - avatar
0
Bagon is it ok if I ask you for some examples while I'm progressing? (There is the while world again haunting me)
5th Jul 2020, 10:09 PM
Whally O.
Whally O. - avatar