<jupyter_start><jupyter_text>1) Keep adding the next child till you get -12) How many childrens does 5 have?<jupyter_code>class TreeNode:
    def __init__(self, data):
        self.data = data
        self.children = list()
def takeTreeInput():
    print("Enter root Data")
    rootData = int(input())
    
    if rootData == -1:
        return None
    root = TreeNode(rootData)
    
    print("Enter number of children for ", rootData)
    childrenCount = int(input())
    for i in range(0, childrenCount):
        child = takeTreeInput()
        root.children.append(child)
    return root
def printTreeDetailed(root):
    if root == None:
        return 
    
    print(root.data, ": ", end = "")
    for child in root.children:
        print(child.data, ",", end = "")
    
    print()
    
    for child in root.children:
        printTreeDetailed(child)
root = takeTreeInput()
printTreeDetailed(root)<jupyter_output>Enter root Data
5
Enter number of children for  5
4
Enter root Data
2
Enter number of children for  2
0
Enter root Data
9
Enter number of children for  9
2
Enter root Data
15
Enter number of children for  15
0
Enter root Data
1
Enter number of children for  1
0
Enter root Data
8
Enter number of children for  8
0
Enter root Data
7
Enter number of children for  7
0
5 : 2 ,9 ,8 ,7 ,
2 : 
9 : 15 ,1 ,
15 : 
1 : 
8 : 
7 :
{'fraction_non_alphanumeric': 0.08718330849478391, 'fraction_numerical': 0.03278688524590164, 'mean_word_length': 2.7202216066481992, 'pattern_counts': {'":': 1, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '497019', 'license': 'Unlicense', 'n_tokens_mistral': 442, 'n_tokens_neox': 431, 'n_words': 168, 'path': '17 Generic Trees/17.03 Take Tree Input (Recursively).ipynb', 'repo_name': 'suhassuhas/Coding-Ninjas---Data-Structures-and-Algorithms-in-Python', 'size': '1342'}