[Python] Baekjun 10807 - Counting
We have summarized the solution for counting specific values using lists and maps in Python.
한국어 원문은 여기에서 볼 수 있습니다.
[Python] Baekjun 10807 - Counting
Solution
1
2
3
4
5
6
7
8
9
10
11
num = int(input())
arr = list(map(int, input().split()))
v = int(input())
cnt = 0
for i in range(num):
if arr[i] == v:
cnt += 1
print(cnt)
Result of map
- It is a map object, not a list ex)
<map object at 0x...> - Therefore, you need to wrap it in
list()and make it into a list.