Python3 代码
class Solution(object):
def getNumberOfK(self, nums, k):
"""
:type nums: list[int]
:type k: int
:rtype: int
"""
c = 0
for i in range (len(nums)):
if nums[i] == k:
c += 1
return c