0

I have a list of lists of the form:

mylist =[[False], [False], [False], [False], [False], [False], [False], [False], [False], [True], [False], [False], [False], [False], [False], [False], [False], [True], [False], [False], [True], [True], [False], [False], [False], [False], [False], [True]]

I'd like it just to be [False,False,......]

I've tried using list comprehension but this didn't work:

mylist= [x for x in mylist]

After I do this I'd like to compare it to a list of the same size and structure and see how accurate it is (percentage wise), 100% would mean False is the 1st element in both lists, True is the 6th element in BOTH lists etc.

I'm thinking of:

mylis1= [1,2,3,4,5,6,7]
mylis2= [1,2,3,0,0,6,7]
totalacc= 0

for x in mylis1:
    for y in mylis2:
        if x ==y:
            totalacc+=1
        else:
            continue

totalacc= totalacc/len(mylis1)

But is there a nicer way of doing this?

Could anyone help with this?

martineau
  • 119,623
  • 25
  • 170
  • 301

0 Answers0