<jupyter_start><jupyter_text>Assignment Question 4 The digital root of a number n is obtained as follows: Add up the digits n to get a new number. Add up the digits of that to get another new number. Keep doing this until you get a number that has only one digit. That number is the digital root. For example, if n = 45893 , we add up the digits to get 4 + 5 + 8 + 9 + 3 = 29 . We then add up the digits of 29 to get 2 + 9 = 11 . We then add up the digits of 11 to get 1 + 1 = 2 . Since 2 has only one digit, 2 is our digital root. Write a function that returns the digital root of an integer n . [Note: there is a shortcut, where the digital root is equal to n mod 9, but do not use that here.]<jupyter_code>def main():
    num = raw_input ('Enter the number to find it digital root')
    print num, '\n'
    D_root(num)
    print 'The digital root of',num,'is:',D_root(num)
    
def D_root(num):
    if len(num) ==1:
        return num
    else:
        sum = 0
        for i in num:
            sum += int(i)
        num = str(sum)
        return D_root(num)
main()<jupyter_output>Enter the number to find it digital root1234
1234 

The digital root of 1234 is: 1
{'fraction_non_alphanumeric': 0.07204116638078903, 'fraction_numerical': 0.036020583190394515, 'mean_word_length': 2.752411575562701, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '493280', 'license': 'MIT', 'n_tokens_mistral': 393, 'n_tokens_neox': 349, 'n_words': 198, 'path': 'Untitled4.ipynb', 'repo_name': 'jaishee/MAT_203', 'size': '1166'}