Return the number of items in a which are, or which equal, b.
(a, b)
| 163 | return b in a |
| 164 | |
| 165 | def countOf(a, b): |
| 166 | "Return the number of items in a which are, or which equal, b." |
| 167 | count = 0 |
| 168 | for i in a: |
| 169 | if i is b or i == b: |
| 170 | count += 1 |
| 171 | return count |
| 172 | |
| 173 | def delitem(a, b): |
| 174 | "Same as del a[b]." |