2

I have a JSON array, each item contain a boolean list of 10 values, I need to decide for each item if it's flagged as true or false by performing AND on the first three items in boolean list.

I am looking for some "elegant" non-looping way to implement this.

Example of the json:

[
  {
  "eFcw":{
    "available":true,
    "isFcwvCalculated":false,
    "clqId":-1,
    "clqId_ASIL":-1,
    "asilFailures":4098,
    "IPB_fcwResults":{
      "FCW_withA_status":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
      }
      }},
      {
  "eFcw":{
    "available":true,
    "isFcwvCalculated":false,
    "clqId":-1,
    "clqId_ASIL":-1,
    "asilFailures":4098,
    "IPB_fcwResults":{
      "FCW_withA_status":[false,true,false,false,false,false,false,false,false,false,false,false,false,false,false]
      }
      }}]
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Igal
  • 4,603
  • 14
  • 41
  • 66

1 Answers1

3

You could try using all() on a slice of your list of booleans:

all(list_of_bools[:3])
aaossa
  • 3,763
  • 2
  • 21
  • 34