Unable to execute the Linear Search function

def linear_search(cards, query):
    
    for index in range(len(cards)):
        if cards[index]==query:
            return index
    else:
           return -1

tests =     [{
    'input' :  {
                'cards' : [13, 11, 10, 7, 4, 3, 2, 1],
                'query' : 7
            },
     'output' : 4
    }]

result = linear_search(tests['input']['cards'], tests['input']['query'])
result

Giving below error -

TypeError                                 Traceback (most recent call last)
<ipython-input-15-919999700363> in <module>
----> 1 result = linear_search(tests['input']['cards'], tests['input']['query'])
      2 result

TypeError: list indices must be integers or slices, not str

You need to pick specific test from tests in order to be able to get it’s input values.

Thanks…just realized. Was wondering where I’ve gone wrong since last couple of hours.