-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday8.py
More file actions
26 lines (23 loc) · 901 Bytes
/
day8.py
File metadata and controls
26 lines (23 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Given n names and phone numbers, assemble a phone book that maps friends' names to their respective
phone numbers. You will then be given an unknown number of names to query your phone book for.
For each name queried, print the associated entry from your phone book on a new line in the form
name=phoneNumber; if an entry for name is not found, print Not found instead.
Note: Your phone book should be a Dictionary/Map/HashMap data structure.
"""
if __name__ == '__main__':
size = int(input())
dictionary = {}
arr = [0]* size
for i in range(size):
arr[i] = list(input().split())
dictionary[arr[i][0]] = arr[i][1]
while True:
try:
query = input()
if query in dictionary:
print(f'{query}={dictionary[query]}')
else:
print('Not found')
except:
break