from bintree import Bintree tree = Bintree() print("Putta in ord, avsluta med retur") while True: word = input() if word == "": break tree.put(word) print("Hela trädet:") tree.write() print("Sök ord, avsluta med retur") while True: word = input() if word == "": break if tree.exists(word): print(word, "finns")
ordlista = f.readlines() for i in range(len(ordlista)): ordlista[i] = ordlista[i].rstrip() swedish = Bintree() for ord in ordlista: swedish.put(ord) f.close() f = open("english") ordlista = f.read().split() oldtree = Bintree() for i in range(len(ordlista)): ordlista[i] = ordlista[i].strip('",.') print(ordlista) for o in ordlista: if oldtree.exists(o): continue if swedish.exists(o): print(o) oldtree.put(o)
ordlista = f.readlines() for i in range(len(ordlista)): ordlista[i] = ordlista[i].rstrip() swedish = Bintree() for ord in ordlista: swedish.put(ord) f.close() f = open("english") ordlista = f.read().split() oldtree = Bintree() for i in range(len(ordlista)): ordlista[i] = ordlista[i].strip('",.') print (ordlista) for o in ordlista: if oldtree.exists(o): continue if swedish.exists(o): print(o) oldtree.put(o)
from bintree import Bintree tree=Bintree() print("Putta in ord, avsluta med retur") while True: word=input() if word=="": break tree.put(word) print("Hela trädet:") tree.write() print("Sök ord, avsluta med retur") while True: word=input() if word=="": break if tree.exists(word): print(word,"finns")