At ancient times,There are no calculators this casting out nines approach is used to tally the calculations and this is a very good approach to find the digital root of a number.
def digital_root(n): return 9 if n%9==0 else n%9
OUTPUT
print(digital_root(942))
6