As the task describe, you may confidently wrote down some code like below what I done at first:
N = int(input())
d = dict()
for _ in range(0, N):
name, number = input().split()
d[name] = number
for _ in range(0, N):
name = input()
if name in d:
print("{}={}".format(name, d[name]))
else:
print("Not found")
You press Run Rode button, it works. And then you press Submit Code and have a cup of tea π΅...Oops Runtime Error :( occurred in test case 1 which the first input line is 100000.
But once you take the full testcase and run it in your local machine, you can get the error detail:
ValueError Traceback (most recent call last)
<ipython-input-1-bec769e0bec0> in <module>()
3
4 for _ in range(0, N):
----> 5 name, number = input().split()
6 d[name] = number
7
ValueError: not enough values to unpack (expected 2, got 1)
Once take a peek at the input testcase, you will find out that the n subsequent lines after the first line actually does not match number 100000
πOK, just need to do a little change to work. Here's an example
import sys
_ = int(input())
d = dict()
for line in sys.stdin:
line_splited = str(line).split(" ")
if len(line_splited) == 2:
d[line_splited[0]] = line_splited[1].replace('\n', '')
else:
name = line_splited[0].replace('\n', '')
if name in d:
print("{}={}".format(name, d[name]))
else:
print("Not found")