- 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!
20 Antworten
+ 1
Great, enjoy your nap, thanks
+ 1
Bagon it was all good and perfect, thank you very much!
+ 1
Thank you! 🥃🍻🍺 Bagon
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
0
You're fast man! 😆 , I was looking the code and then suddenly changed
0
One question, please, do I need to declare this:
number = int(input('Enter a number: '))
?
0
Can I send you my version when I finish?
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
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
0
Bagon, what's up? Ok I'll try again to see how it goes through, thank you
0
Bagon is it ok if I ask you for some examples while I'm progressing? (There is the while world again haunting me)