Digital root
Your task
Given a non-negative integer n, repeatedly replace it with the sum of its digits until a single digit (0-9) remains, then return that digit. For example 38 to 3+8=11 to 1+1=2. n fits in a normal integer.
Examples
digit_root(n: int) -> intExample 1
Input
digit_root(38)Output
2