By running my code, the python returned this warning: TypeError: 'int' object has no attribute 'getitem'
What's wrong with my code?
And when I ran the sum() to add two int(), it returned TypeError: 'int' object is not iterable. What does it mean?
def digit_sum(n): for i in range(len(str(n))): print sum(n[i]) digit_sum(123) #Why can't sum() add two int()? and why the warning was different? print sum(int(1)+int(3))