tree

来源:互联网 发布:php构造函数和析构函数 编辑:程序博客网 时间:2024/06/06 12:22
#从字符串集合tree里查找


def tree():
    a = 'banana'
    b = 'band'
    c = 'bee'
    d = 'absolute'
    e = 'acm'


    while(True):
        read = raw_input("Enter what you want to select:")


        tree = [a,b,c,d,e]


        for i in range(len(read)):


            arr = []
            
            for j in range(len(tree)):


                    if read[i] == tree[j][i]:
                        arr.append(j)


        for k in range(len(arr)):
            print tree[arr[k]]
                
tree()
0 0