I have to compare two list of tuple elements and combine some math calculation of the elements themselves.
More precisely, I have the following lists, every tuple of the list_1 represents a single character and it's frequence into a text ex. ("a" : "10), every tuple of the list_2 represents a bigram of characters and their frequence into the same text ex. ("a", "b" , "2") :
list_1=[("a","10"), ("b","5"), ("c","3"),("d","1")]
list_2= [("a", "b", "4"), ("b","c","1")]
I need to iterate over the two lists and in the case there is a match between the characters of list_2 and the caracters of the list_1, my goal is to make the following analisys:
x= ("a","10")*("b","5")/("a","b","4")= 10*5/4
I hope i was clear in the explanation of the problem...