[Tutor] about tree input

2018-04-22 Thread 劉權陞
To deposit a nodes in the tree (adding a new node), for example: put 3: {} in the Tree branch at branch tuple (2, 4, 1, 5) . If don't use : def f(T,k,v): m=len(T) if m==0: Tree[k]=v elif m==1: Tree[T[0]][k]=v elif m==2: Tree[T[0]][T[1]][k]=v elif m==3:

Re: [Tutor] about tree input

2018-04-22 Thread Zachary Ware
Basically what you want to do here is give Tree a local name (d), loop through T reassigning d to d[k_from_T], and then d[k] = v after the loop. T can be arbitraily long, and Tree can actually be and contain any indexable type. If this pointer isn't enough to send you in the right direction, I'll