标签:while += obj lse ret int turn type class
class Solution(object):
def addDigits(self, num):
"""
:type num: int
:rtype: int
"""
sum=num%10
a=num/10
if a >=1:
while a > 9:
sum += a%10
a=a/10
sum += a
if sum <10:
return sum
else:
return self.addDigits(sum)
标签:while += obj lse ret int turn type class
原文地址:https://www.cnblogs.com/ffeng0312/p/9471883.html