mlhoutel / compy

transformations on python programs
https://mlhoutel.github.io/compy/
Mozilla Public License 2.0
2 stars 0 forks source link

Variable update in loop #10

Open mlhoutel opened 9 months ago

mlhoutel commented 9 months ago
test_list = [12, 67, 98, 34]

res = []
for ele in test_list:
    sum = 0
    for digit in str(ele):
        sum += int(digit)
    res.append(sum) # <= here

print ("List Integer Summation : " + str(res))