I wanted to create a simple binary tree as followed by this image:
basically empty , but the last values so I created the root list :
root = [list(),list()]
and made a recursive function to populate it all :
def TF(nodeT,nodeF , i):
if i == 35 : return 'done'
TF(nodeT.append([]),nodeT.append([]) , i = i + 1) #append T , F in the true node
TF(nodeF.append([]),nodeT.append([]) , i = i + 1) #append T , F in the false node
my problem is simple list.append(something) in python return "None" so as soon as the function get called again (TF(None,None,1)) None.append doesnt exists.
how do I solve this? thanks in advance.
also if you have any suggestion on how to make this more efficient or in another way (never got to test my code so I am not sure on how it will do)
(my final goal is to have a True False map and an argument so : "FTFTFFFTFTF" will bring up the letter "M" etc ...)