Python code: Count Items Matching a Rule
\nclass Solution:\n    def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int:\n        ct=0\n        c=0\n        rule={"type":0,"
```\nclass Solution:\n    def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int:\n        ct=0\n        c=0\n        rule={"type":0,"color":1,"name":2}\n        for i in rule:\n            if i == ruleKey:\n                c=rule[i]\n                break\n        for i in range(len(items)):\n            if items[i][c]==ruleValue:\n                ct+=1\n        return ct\n```
['Python']