I'm a novice when it comes to recursion (and python, be kind haha), so I wanted to give it a go with a codewars problem (https://www.codewars.com/kata/541c8630095125aba6000c00/train/python)
I'm just super confused as to why the break gets ignored, and the recursion continues.
def digital_root(n):
x = list(str(n))
z = 0
while True:
for i in range(0, len(x)):
x[i] = int(x[i])
for i in x:
z = i + z
if z < 10:
break
elif z >= 10:
digital_root(z)
return z
print(digital_root(942))
breakis met whenz<10, which means previous z + all values of x less than 10, i.e, previous z < -5, but that's impossible using your current code