My issue
As a new programmer I do not understand what is the purpose of N in line 3. N was never used in the code and when I try to remove this from code and also removed value of N from custom inputs I get an error
error I got after removing N
Traceback (most recent call last): File "/mnt/sol.py", line 10, in <module> index = A.index(X) ValueError: <map object at 0x1460d089cbb0> is not in list
My code
# Update the blanks below to solve the problem
t = int(input())
for i in range(t):
N, X = map(int, input().split())
A = list(map(int, input().split()))
#variable to store the count of X
occurrence = A.count(X)
#variable to store the position / index of X
index = A.index(X)
print(occurrence, index)
Learning course: Python for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone