Suppose I have a list of tuples:
tuple_library = [('a', 'z', '1'), ('r', '3', 'b'), ('m', '1', 'l')]
What I want to do is to check if the following tuple is present on the tuple_library.
search_list = [('a','a','1'), ('m', '1', 'l')]
def search_the_tupple(t_lib, s_list):
for item in t_lib:
if item in s_list:
return(item)
print(search_the_tupple(tuple_library, search_list))
this code works ok if the tuple_library and the search_list is small, but as those two item increases, the longer time needed in order for it to complete.
How do we approach this problem?
from Finding a tuple in large a very large list
No comments:
Post a Comment