Add digits as long as they are one digit long

PHOTO EMBED

Fri May 21 2021 08:17:00 GMT+0000 (Coordinated Universal Time)

Saved by @isnottom #python

class Solution:
    def addDigits(self, num: int) -> int:
        if num==0:
            return 0
        elif num%9==0:
            return 9
        else:
            return num%9

#----------------------------------------

class Solution:
    def addDigits(self, num: int) -> int:
        if num==0:
            return 0
        return 1+(num-1)%9
  
        
content_copyCOPY

https://leetcode.com/problems/add-digits/