思路:直接遍历一遍,出现就加1
# -*- coding:utf-8 -*- class Solution: def GetNumberOfK(self, data, k): # write code here cnt = 0 for i in data: if i == k: cnt += 1 return cnt