iwant know where is the mistake of this code sumDigits = 0 for c in str(1952): sumDigits += int(c) print(sumDigits) x = (100) divisors = () for i in range(1,x): if x%i == 0: divisors = divisors+(i,) print(divisors) print(divisors[0] + divisors[1]) print(divisors[2:4])
Well, what is it supposed to be doing vs. what is it doing?
Another thing that can help is to add in a divider so you can tell what each of the loops is doing: ``` sumDigits = 0 for c in str(1952): sumDigits += int(c) print(sumDigits) x = (100) divisors = () for i in range(1,x): if x%i == 0: divisors = divisors+(i,) print(divisors) print(divisors[0] + divisors[1]) print(divisors[2:4]) print("---") ``` See, that way the output is: ``` >>> 1 (1, 2, 4, 5, 10, 20, 25, 50) 3 (4, 5) --- 10 (1, 2, 4, 5, 10, 20, 25, 50) 3 (4, 5) --- ``` and so on. That is much clearer as to when you step through the `for c in str(1952):` loop.
drowning plz help
Well, I need to know what it is supposed to do. Right now it is just a block of code with no explanation.
thank you e.mccormick iwas write this code and runed thank you for you
Join our real-time social learning platform and learn together with your friends!