Recursive Digit Sum

  • + 2 comments

    Can someone provide explaination as to what "return(x if x else 9)" is doing? I understand it is returning the output, but I do not understand the logic of how because how does the proram know when to return '9' versus 'x'?