What's wrong with this python snippet:
for zhszam in pontok.keys():
s = 0
for p in pontok[zhszam]:
if p.isdigit():
s += int(p)
print s
pontok[zhszam] = s
return pontok
where pontok is {1: ['10', ' 5', ' 3', ' 10', ' 7'], 2: ['10', ' 5', ' 3', ' 10']}
.
It gives the following wrong output somehow:
10
10
{1: 10, 2: 10}
While the values should be the sum of the numbers.
Thanks in advance!