How to replace sublist values if they are all the same

hello I am trying to replace “true” items in a boolean sublist if the sublist contains more than one true value. Below you can see my work so far (in the orange box), but I am having trouble stitching the lists back together. I am under the impression, that there is an easier way to do this, but I cant see it. Can anyone point me in the right direction? Thanks!

I am having some problems to follow what are you after (:

You are triying to keep just the first True in each list? and then replace some values? Or you just want to keep one true in each list and that is all?

Could we know a bit more about your goal?

I want to keep the first true in each sublist, and replace any other trues in that sublist with false. But in the sublists that only have one true, I want to leave them alone. :slight_smile:

@mix Like this?

1 Like

Leave them alone means remove falses or just leave one true?

EDIT: You may already have an answer!

Thanks @Vikram_Subbaiah!

1 Like

Wait a minute, that method breaks down if the sublist doesnt contain a true. See below. I need it to leave the sublist alone if it doesnt contain a true. Seems like the -1 is messing things up. But I dont know how to handle that because I dont know what that is. Thanks

No need to panic, just add another step :slight_smile: