对一个数的每一位数字求平方

题目描述:

# Welcome. In this kata, you are asked to square every digit of a number.
# For example, if we run 9119 through the function, 811181 will come out,
# Note: The function accepts an integer and returns an integer

我的解答:
def square_digits(num):
a = ''
for i in str(num):
a = a + str(int(i)**2)
return int(a)
原文地址:https://www.cnblogs.com/wlj-axia/p/12638831.html