# Playing Around on LeetCode

`class Solution(object):    def countMatches(self, items, ruleKey, ruleValue):        """        :type items: List[List[str]]        :type ruleKey: str        :type ruleValue: str        :rtype: int        """        match_rule_count = 0        rule_indexes = {            'type': 0,            'color': 1,            'name': 2        }        rule_index = rule_indexes[ruleKey]        for item in items:            if item[rule_index] == ruleValue:                match_rule_count += 1        return match_rule_count`
`class Solution(object):    def countMatches(self, i, k, v):        c, s = 0, {'type': 0,'color': 1,'name': 2}        a = s[k]        for j in i:            if j[a] == v:                c += 1        return c`
`class Solution(object):    def countMatches(self, i, k, v):        c, s = 0, {'t': 0,'c': 1,'n': 2}        a = s[k[0]]        for j in i:            if j[a] == v:                c += 1        return c`
`class Solution(object):    def countMatches(self, i, k, v):        c = 0        for j in i:            if (k[0] == 't' and j[0] == v) or (k[0] == 'c' and j[1] == v) or (k[0] == 'n' and j[2] == v):                c += 1        return c`

--

--

--

## More from Daryan Hanshew

I’ve learned more about PERL than I care to admit.

Love podcasts or audiobooks? Learn on the go with our new app.

## Daryan Hanshew

I’ve learned more about PERL than I care to admit.