0

does anybody knows why this function doesn´t work very well:

f=lambda n: reduce(lambda x,y:x**2+y**2, map(int,str(n)))

I want that this function add the square of the digits of a number

an example of what i want:

f(442)=4**2+4**2+2**2=36 and it's giving me f(442)=1028!!!:S

However fou numbers with 2 digits the function works!