728x90
Key-Value pair mappings using a Map or Dictionary data structure
#Sample Input
3
sam 99912222
tom 11122222
harry 12299933
sam
edward
harry
#Sample Output
sam=99912222
Not found
harry=12299933
1. Dictionary(사전) 타입을 이용해서 key-value 쌍으로 구성된 데이터를 구축
2. 출력하는 문제이다.
n = int(input())
dict_list = {}
for i in range(n):
name, num = input().split()
dict_list[name] = num
while True:
try:
name = input()
if name in dict_list:
print(f"{name}={dict_list[name]}")
else:
print('Not found')
except:
break
'코드연습 > Python' 카테고리의 다른 글
for과 remove, del을 이용해서 item 삭제 시 유의할 점. (0) | 2022.04.01 |
---|---|
input() v.s. sys.stdin.readline() (0) | 2022.03.31 |
HackerRank | Capitalize! (0) | 2021.12.19 |
HackerRank | Alphabet Rangoli (0) | 2021.12.19 |
HackerRank | Text Alignment (0) | 2021.12.12 |