Hello all,
I have some difficulty with something I want to do:
I want to 'measure' the likeness of two lists of integers. What I mean is I want for example to compare:
list1 = [0, 0, 1, 1, 0, 1, 0]
list2 = [0, 0, 0, 1, 1, 1, 0]
these two lists. What I need is to measure these lists where if 0 == 0 it gets a score of say +1, where 1 == 1 it gets a score of +3 and if 0 != 1 or 1 != 0 it gets a score of -1.
In this little example I need to compare list1[0] and list2[0], since they're bout 0 it gets +1 to the score. list1[1] and list2[1] are both 0 so again +1, list1[2] and list2[2] gets -1 and list1[3] and list2[3] get +3 and so on.
In my example the score would have to be: +1 +1 -1 + 3 - 1 +3 + 1 = 7. I'm trying to find a loop that works this way but since I'm not that far with python I could use some pointers or starters.